Delphi in a Unicode World Part I
---
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 how Unicode will be implemented in Delphi
2009.
//
Introduction
The Internet has broken down geographical barriers that enable world-wide
software distribution. As a result, applications can no longer live in a purely
ANSI-based environment. The world has embraced Unicode as the standard means of
transferring text and data. Since it provides support for virtually any writing
system in the world, Unicode text is now the norm throughout the global
technological ecosystem.
What is Unicode?
Unicode is a character
encoding scheme that allows virtually all alphabets to be encoded into a single
character set. Unicode allows computers to manage and represent text most of the
world¡¯s writing systems. Unicode is managed by The Unicode Consortium and codified in a standard.
More simply put, Unicode is a system for enabling everyone to use each other¡¯s
alphabets. Heck, there is even a Unicode version of
Klingon.
This series of articles isn¡¯t meant to give you a full rundown of exactly
what Unicode is and how it works; instead it is meant to get you going on using
Unicode within Delphi 2009. If you want a good overview of Unicode, Joel Spolsky
has a great article entitled ¡°The Absolute Minimum
Every Software Developer Absolutely, Positively Must Know About Unicode and
Character Sets (No Excuses!)¡± which is highly recommended reading. As Joel
clearly points out ¡°IT¡¯S NOT THAT HARD¡±. This article, Part I of III, will
discuss why Unicode is important, and how Delphi will implement the new UnicodeString type.
Why Unicode?
Among the many new features found in De
Ïà¹ØÎĵµ£º
http://hi.baidu.com/rainbow_chaser/blog/item/7eb5f001c0d864e508fa93ac.html
1.·ÀֹˢÐÂʱÉÁ˸µÄÖÕ¼«½â¾ö°ì·¨
{ ·ÀֹˢÐÂʱÉÁ˸µÄÖÕ¼«½â¾ö°ì·¨(¶Ô¸¶Ë«»º³åÎÞЧʱ) }
Perform($000B, 0, 0); //ËøÆÁÄ» ·ÀÖ¹ÉÁ˸
// ×öһЩ»á·¢ÉúÑÏÖØÉÁ˸µÄÊÂÇé..
//½âËøÆÁÄ»²¢ÖØ»
Perform($000B, 1, 0);
RedrawWindow(Handle, nil, ......
×î½ü¾³£»áÄ£ÄâÍøÒ³Ìá½»·µ»ØÍøÒ³Ô´Â룬Ȼºó»ñµÃÍøÒ³ÖÐÏàÓ¦µÄÔªËØ£¬ÓÚÊÇÐèÒª³£³£½âÎöHtmlÖÐÏàÓ¦µÄ¸÷ÖÖÔªËØ£¬ÍøÂçÊǸöºÃ¶«Î÷£¬ËÑË÷Ò»·¬£¬¾ÍÕÒµ½ÁË
ºÃ¼¸¸öDelphi°æ±¾µÄHtmlParserµÄÀà¿â£¬ÊÔ×ÅʹÓÃÁ˼¸¸ö£¬·¢ÏÖ½âÎöÆðÀ´¶¼²»ÍêÕû£¬»ò¶à»òÉٵĻسöÏÖһЩÎÊÌ⣡ÓÚÊÇÏëµ½ÁËÈç¹û½çÃæÉÏÓÐÒ»¸öä¯
ÀÀÆ÷£¬ÎÒÃÇ¿ÉÒÔͨ¹ýWebBrowserµÄDocu ......
TreeViewÓɽڵ㹹³É,½¨Ê÷ͨ¹ý¶ÔTreeView.itemsÊôÐÔ½øÐвÙ×÷¡£ItemsÊÇÒ»¸öTTreeNodes¶ÔÏó,ÕâÊÇÒ»¸öTTreeNode¼¯¡£
Ò»¡¢Õë¶ÔTTreeNodes,Ò²¾ÍÊÇ TreeView.Items,ÓÐÕâЩÊôÐÔ:
1¡¢count,½Úµã¸öÊý¡£
2¡¢item[index] ,ͨ¹ýindexµÃµ½½Úµã¡£
¶þ¡¢Õë¶ÔTTreeNodes,Ò²¾ÍÊÇ TreeView.Items,³£ÓõÄÌí¼Ó½ÚµãµÄ²Ù×÷ ......
type
TCharStack = class(TStack)
private
function GetTop: Char;
public
function Pop: Char;
function Push(Item: Char): Char;
property Top: Char read GetTop;
end;
const
FindSet = ['(',')'];
implementation
{$R *.dfm}
{ TCharStack }
......
Format
typeµÄ¿ÉÄÜÖµÓÐÏÂÁÐÕâЩ£º
(1) d ÓзûºÅÊ®½øÖÆÊý
Args±ØÐëÊÇÓзûºÅÕûÐÍÊý¡£Èç¹ûÔÚ¸ñʽ»¯×Ö·û´®Öл¹¼ÓÈëÁË["." prec]£¬ÔòÈç¹ûArgs
µÄ³¤¶ÈÈç¹ûСÓÚ¸ø³öµÄ¾«¶ÈÊýʱ£¬ÔÚÇ°±ßÌî²¹0£»Èç¹û´óÓÚ¾«¶ÈÊý£¬°´Êµ¼Ê³¤¶ ......