latintest_mainform.pas
来自「source code for the Marco Cantu s book D」· PAS 代码 · 共 59 行
PAS
59 行
unit LatinTest_MainForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TFormLatinTest = class(TForm)
btnNewType: TButton;
Memo1: TMemo;
btnCompareCharSet: TButton;
btnCyrillic: TButton;
procedure btnNewTypeClick(Sender: TObject);
procedure btnCompareCharSetClick(Sender: TObject);
procedure btnCyrillicClick(Sender: TObject);
private
procedure Log (const strMsg: string);
public
end;
var
FormLatinTest: TFormLatinTest;
implementation
{$R *.dfm}
type
Latin1String = type AnsiString(28591);
CyrillicString = type Ansistring(1251);
procedure TFormLatinTest.btnCompareCharSetClick(Sender: TObject);
var
str1: Latin1String;
str2: AnsiString;
I: Integer;
begin
for I := 128 to 255 do
begin
str1 := str1 + AnsiChar (I);
str2 := str2 + AnsiChar (I); // copies the value without converting it
end;
for I := 0 to 15 do
begin
Log (IntToStr (128 + I*8) + ' - ' + IntToStr (128 + I*8 + 7));
Log ('Lati: ' + Copy (str1, 1 + i*8, 8));
Log ('Ansi: ' + Copy (str2, 1 + i*8, 8));
end;
end;
procedure TFormLatinTest.btnCyrillicClick(Sender: TObject);
var
str1: CyrillicString;
I: Integer;
begin
str1 := 'a string with an accent: Cant
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?