Delphi in a Unicode World Part II
Delphi in a Unicode World Part II: New RTL Features and
Classes to Support Unicode
By: Nick
Hodges
ÔÎÄÁ´½Ó:http://dn.codegear.com/article/38498
Abstract: This article will cover the new features of the Tiburon
Runtime Library that will help handle Unicode strings.
//
Introduction
In Part I, we saw how
Unicode support is a huge benefit for Delphi developers by enabling
communication with all characters set in the Unicode universe. We saw the basics
of the UnicodeString type and how it will be used in Delphi
In Part II, we¡¯ll look at some of the new features of the Delphi Runtime
Library that support Unicode and general string handling.
TCharacter Class
The Tiburon RTL includes a new class called TCharacter, which is found in the Character unit. It is a sealed class
that consists entirely of static class functions. Developers should not create
instances of TCharacter, but
rather merely call its static class methods directly. Those class functions do a
number of things, including:
Convert characters to upper or lower case
Determine whether a given character is of a certain type, i.e. is the
character a letter, a number, a punctuation mark, etc.
TCharacter uses the standards set forth by the Unicode consortium.
Developers can use the TCharacter class to do many things previously done
with sets of chars. For instance, this code:uses
Character;
begin
if MyChar in [¡®a¡¯...¡¯z¡¯, ¡®A¡¯...¡¯Z¡¯] then
begin
...
end;
end;
can be easily replaced with uses
Character;
begin
if TCharacter.IsLetter(MyChar) then
begin
...
end;
end;
The Character unit also
contains a number of standalone functions that wrap up the functionality of each
class function from TCharacter, so
if you prefer a simple function call, the above can be written as:uses
Character;
begin
if IsLetter(MyChar) then
begin
...
end;
end;
Thus the TCharacter class can
Ïà¹ØÎĵµ£º
//²ÉÓõݹ鷽·¨£¬D7±àÒëµ÷ÊÔͨ¹ý¡£
//Êý¾Ý²ÉÓÃADOQuery¶ÁÈ¡£¬²¢½«Êý¾ÝÔÝ´æÔÚÒ»¸ö¶¯Ì¬Êý×éÖУ¬Ê÷ÐÎÁÐ±í¿Ø¼þΪTreeView¡£
procedure TForm1.LoadTreeInfo;
type
TInfo = record
ID, //´úÂë
Name, //Ãû³Æ
&nb ......
delphi dll ʵÀý Óë dll´°ÌåʵÀý
±¾¶¯Ì¬Á´½Ó¿â·½·¨ÓÐ
Min,Max,SynAPP,ShowForm,showmyform
dll¹¤³ÌÎļþ
Library Project1;
uses
dllUnit1 in 'dllUnit1.pas' {Form1};
function Min(X, Y: Integer): Integer; export;
begin
if X < Y then Min := X else Min := Y;
end;
function Max(X, Y: Integer): ......
1¡¢TStringListÖ§³ÖµÄ×î´óÐÐÊýÊǶàÉÙ£¿£¨http://topic.csdn.net/t/20060209/14/4547405.html£©
Â¥Ö÷½áÂÛ£º“TStringListµÄLoadfromFileº¯ÊýÓ¦¸ÃÖ»ÄܶÁÈ¡15ÍòÐÐÒÔÄÚµÄÊý¾Ý£¬µ«TStringListºÍTListµÄAddº¯Êý¿ÉÒÔ¼Óµ½¼¸°ÙÍòÐУ¨ÉõÖÁ¸ü¶à£©Ò²²»»á³ö´í¡£³ÌÐò³ö´íµÄÔÒòÓ¦¸ÃÊÇAdd·Ç·¨ÄÚ´æÖ¸Õëµ¼Öµģ¬ÕýÈçtanlim(ÇóѧÕß) &nb ......
Format
typeµÄ¿ÉÄÜÖµÓÐÏÂÁÐÕâЩ£º
(1) d ÓзûºÅÊ®½øÖÆÊý
Args±ØÐëÊÇÓзûºÅÕûÐÍÊý¡£Èç¹ûÔÚ¸ñʽ»¯×Ö·û´®Öл¹¼ÓÈëÁË["." prec]£¬ÔòÈç¹ûArgs
µÄ³¤¶ÈÈç¹ûСÓÚ¸ø³öµÄ¾«¶ÈÊýʱ£¬ÔÚǰ±ßÌî²¹0£»Èç¹û´óÓÚ¾«¶ÈÊý£¬°´Êµ¼Ê³¤¶ ......
---
Delphi in a Unicode World Part I: What is Unicode, Why do you need
it, and How do you work with it in Delphi?
By: Nick
Hodges
ÔÎÄÁ´½Ó£ºhttp://dn.codegear.com/article/38437
Abstract: This article discusses Unicode, how Delphi developers
can benefit from using Unicode, and ho ......