In Delphi 2009:
string = unicodestring; (same: pstring = punicodestring;)
Char = Widechar; (same: Pchar = Pwidechar;)
This example effect chart:
Code files:
Unit Unit1;
Interface
Uses
Windows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms,
Dialogs, Stdctrls;
Type
TForm1 = Class (Tform)
Memo1:tmemo;
Edit1:tedit;
Button1:tbutton;
Button2:tbutton;
Button3:tbutton;
Button4:tbutton;
Button5:tbutton;
Button6:tbutton;
Button7:tbutton;
Procedure Formcreate (Sender:tobject);
Procedure Button1Click (Sender:tobject);
Procedure Button2click (Sender:tobject);
Procedure Button3click (Sender:tobject);
Procedure Button4click (Sender:tobject);
Procedure Button5click (Sender:tobject);
Procedure Button6click (Sender:tobject);
Procedure Button7click (Sender:tobject);
End
Var
Form1:tform1;
Implementation
{$R *.DFM}
Procedure Tform1.formcreate (Sender:tobject);
Begin
Memo1.clear;
Edit1.alignment: = Tacenter;
Edit1.text: = ' in case of Delphi blog ';
Button1.caption: = ' string ';
Button2.caption: = ' ansistring ';
Button3.caption: = ' widestring ';
Button4.caption: = ' Char ';
Button5.caption: = ' Ansichar ';
Button6.caption: = ' widechar ';
Button7.caption: = ' Qing ' + #10 #10 + ' empty ';
Button7.wordwrap: = True;
End
Procedure Tform1.button1click (Sender:tobject);
Var
str:string;
I:integer;
Begin
str: = Edit1.text;
Memo1.clear;
For I: = 1 to Length (str) do MEMO1.LINES.ADD (Str[i]);
End
Procedure Tform1.button2click (Sender:tobject);
Var
str:ansistring;
I:integer;
Begin
str: = Edit1.text;
Memo1.clear;
For I: = 1 to Length (str) do MEMO1.LINES.ADD (Str[i]);
End
Procedure Tform1.button3click (Sender:tobject);
Var
str:widestring;
I:integer;
Begin
str: = Edit1.text;
Memo1.clear;
For I: = 1 to Length (str) do MEMO1.LINES.ADD (Str[i]);
End
Procedure Tform1.button4click (Sender:tobject);
Var
C:char;
Begin
Memo1.clear;
For C in Edit1.text do Memo1.Lines.Add (c);
End
Procedure Tform1.button5click (Sender:tobject);
Var
C:ansichar;
Begin
Memo1.clear;
For C in Ansistring (Edit1.text) do Memo1.Lines.Add (c);
End
Procedure Tform1.button6click (Sender:tobject);
Var
C:widechar;
Begin
Memo1.clear;
For C in Edit1.text do Memo1.Lines.Add (c);
End
Procedure Tform1.button7click (Sender:tobject);
Begin
Memo1.clear;
End
End.