2018-10-02 widechar widestring

xe



unit Unit3;

interface

uses

? Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,

? Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type

tmyarr =array of char;

? TForm3 = class(TForm)

? ? Button1: TButton;

? ? procedure Button1Click(Sender: TObject);

? private

? ? { Private declarations }

? public

? ? { Public declarations }

? end;

var

? Form3: TForm3;

implementation

{$R *.dfm}

procedure test(const arr:tmyarr);

begin

? ? arr[1] := 'X';

end;

procedure TForm3.Button1Click(Sender: TObject);

var

? A :TMYARR ;

begin

? ? SETLENGTH(A,4);

? ? ? A[0] := 'A';

? ? ? A[1] := 'B';

? ? ? A[2] := 'C';

? ? ? TEST(A);

? ? ? ShowMessage( STRING(A));

end;

end.


wwwwwwwwwwwwwwwwwwwwwww

unit Unit1;

interface

uses

? Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

? Dialogs, StdCtrls;

type

? ? tmyarr =array of? char;? //? ? tmyarr =array of widechar;

? TForm1 = class(TForm)

? ? Button1: TButton;

? ? procedure Button1Click(Sender: TObject);

? private

? ? { Private declarations }

? public

? ? { Public declarations }

? end;

var

? Form1: TForm1;

implementation

{$R *.dfm}

procedure test(const arr:tmyarr);

begin

? ? arr[1] := 'X';

end;

procedure TForm1.Button1Click(Sender: TObject);

var

? A :TMYARR ;

begin

? SETLENGTH(A,3);

? ? ? A[0] := 'A';

? ? ? A[1] := 'B';

? ? ? A[2] := 'C';? ? ?

? ? ? TEST(A);

? ? ? ShowMessage( STRING(A));? //?? ShowMessage( wideSTRING(A));

end;

end.

顯示結果不同是因為。

Delphi中最常用的字符類型是Char類型。它是上面兩種字符類型其中一種的別名。DelphiXE中,Char默認為WideChar,但在之前的版本如Delph7中,Char類型代表AnsiChar。所以在使用時要特別注意。? 以后?? Char寫為WIDECHAR???? ,? STRING寫為UNICODESTRING..


d7中有widestring 但是沒有UNICODESTRING

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

  • unit Unit3; interface uses Winapi.Windows, Winapi.Messag...
    netppp閱讀 215評論 0 0
  • 我不知道別人的臉是不是和我一樣,一個小時不去管它,就會浸出厚厚的油脂,手指一抹,像抹一口剛炒完菜的鍋。所以,什么都...
    瞿桂林閱讀 44評論 0 0
  • 楊花迷離傷春風,折柳十里亭。淡霧薄煙輕鎖江。長亭外,應有笙笛。琴弦斷處,當是知音,此去淚沾襟。紫燕掠影啼春深,又道...
    春風化雨2016閱讀 320評論 0 2
  • 【原創(chuàng)兒童文學專題】
    楓鈴木閱讀 746評論 8 18
  • 小時候第一次玩游戲就是爸媽帶我入坑的,當時大概小學一年級,他們搬回來了一臺小霸王,美其名曰是送我的禮物,大概長下面...
    miaowwww閱讀 356評論 0 0

友情鏈接更多精彩內容