UCS瑞士军刀演武堂
//////////////////////////UCSRLTestbed.dpr/////////////////////////////
program UCSRLTestbed;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.Title := 'UCSRLTestbed';
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
///////////////////////////////Unit1.pas///////////////////////////////////
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TntForms, ComCtrls, TntComCtrls, StdCtrls, TntStdCtrls,
xcUCSRLDataStruUnit, xcUCSDLLStatUnit, TntSysUtils, TntDialogs;
type
TForm1 = class(TTntForm)
TntPageControl1: TTntPageControl;
TntTabSheet1: TTntTabSheet;
TntTabSheet2: TTntTabSheet;
TntTabSheet3: TTntTabSheet;
TntTabSheet4: TTntTabSheet;
TntPageControl2: TTntPageControl;
TntTabSheet5: TTntTabSheet;
TntTabSheet6: TTntTabSheet;
TntTabSheet7: TTntTabSheet;
TntTabSheet8: TTntTabSheet;
TntRichEdit1: TTntRichEdit;
TntGroupBox1: TTntGroupBox;
TntRadioButton1: TTntRadioButton;
TntRadioButton2: TTntRadioButton;
TntButton1: TTntButton;
Edit1: TEdit;
TntGroupBox2: TTntGroupBox;
TntRadioButton3: TTntRadioButton;
TntRadioButton4: TTntRadioButton;
TntButton2: TTntButton;
Edit2: TEdit;
TntGroupBox3: TTntGroupBox;
Edit3: TEdit;
TntButton3: TTntButton;
TntGroupBox4: TTntGroupBox;
Edit4: TEdit;
TntButton4: TTntButton;
TntGroupBox5: TTntGroupBox;
TntRadioButton5: TTntRadioButton;
TntRadioButton6: TTntRadioButton;
TntButton5: TTntButton;
Edit5: TEdit;
TntGroupBox6: TTntGroupBox;
Edit6: TEdit;
TntButton6: TTntButton;
TntGroupBox7: TTntGroupBox;
Edit7: TEdit;
TntButton7: TTntButton;
Edit8: TEdit;
TntRichEdit2: TTntRichEdit;
TntRichEdit3: TTntRichEdit;
TntGroupBox8: TTntGroupBox;
TntRadioButton7: TTntRadioButton;
TntRadioButton8: TTntRadioButton;
TntButton8: TTntButton;
Edit9: TEdit;
TntGroupBox9: TTntGroupBox;
TntRadioButton9: TTntRadioButton;
TntRadioButton10: TTntRadioButton;
TntButton9: TTntButton;
Edit10: TEdit;
TntGroupBox10: TTntGroupBox;
TntRadioButton11: TTntRadioButton;
TntRadioButton12: TTntRadioButton;
TntButton10: TTntButton;
Edit11: TEdit;
TntGroupBox11: TTntGroupBox;
Edit12: TEdit;
TntButton11: TTntButton;
TntGroupBox12: TTntGroupBox;
Edit13: TEdit;
TntButton12: TTntButton;
TntGroupBox13: TTntGroupBox;
TntRadioButton13: TTntRadioButton;
TntRadioButton14: TTntRadioButton;
TntButton13: TTntButton;
Edit14: TEdit;
TntRichEdit4: TTntRichEdit;
TntRadioButton15: TTntRadioButton;
TntRadioButton16: TTntRadioButton;
TntRichEdit5: TTntRichEdit;
TntRichEdit6: TTntRichEdit;
TntOpenDialog1: TTntOpenDialog;
TntSaveDialog1: TTntSaveDialog;
TntGroupBox14: TTntGroupBox;
TntRadioButton17: TTntRadioButton;
TntRadioButton18: TTntRadioButton;
TntButton14: TTntButton;
Edit15: TEdit;
TntRadioButton19: TTntRadioButton;
TntGroupBox15: TTntGroupBox;
TntRadioButton20: TTntRadioButton;
TntRadioButton21: TTntRadioButton;
TntButton15: TTntButton;
Edit16: TEdit;
TntRadioButton22: TTntRadioButton;
TntGroupBox16: TTntGroupBox;
TntButton16: TTntButton;
TntRadioButton23: TTntRadioButton;
TntGroupBox17: TTntGroupBox;
TntButton17: TTntButton;
TntRadioButton24: TTntRadioButton;
TntGroupBox18: TTntGroupBox;
TntButton18: TTntButton;
TntRadioButton25: TTntRadioButton;
TntGroupBox19: TTntGroupBox;
TntButton19: TTntButton;
TntGroupBox20: TTntGroupBox;
TntButton20: TTntButton;
TntRadioButton26: TTntRadioButton;
TntRadioButton27: TTntRadioButton;
TntGroupBox21: TTntGroupBox;
TntButton21: TTntButton;
TntRadioButton28: TTntRadioButton;
TntRichEdit7: TTntRichEdit;
TntRichEdit8: TTntRichEdit;
TntGroupBox22: TTntGroupBox;
TntButton22: TTntButton;
TntRadioButton29: TTntRadioButton;
TntGroupBox23: TTntGroupBox;
TntButton23: TTntButton;
TntRadioButton30: TTntRadioButton;
TntGroupBox24: TTntGroupBox;
TntButton24: TTntButton;
TntRadioButton31: TTntRadioButton;
TntPageControl3: TTntPageControl;
TntTabSheet9: TTntTabSheet;
TntTabSheet10: TTntTabSheet;
TntTabSheet11: TTntTabSheet;
TntRichEdit9: TTntRichEdit;
TntRichEdit10: TTntRichEdit;
TntGroupBox25: TTntGroupBox;
TntButton25: TTntButton;
TntRadioButton32: TTntRadioButton;
TntComboBox1: TTntComboBox;
TntGroupBox26: TTntGroupBox;
TntButton26: TTntButton;
TntRadioButton33: TTntRadioButton;
TntGroupBox27: TTntGroupBox;
TntButton27: TTntButton;
TntComboBox2: TTntComboBox;
TntRadioButton34: TTntRadioButton;
TntGroupBox28: TTntGroupBox;
TntButton28: TTntButton;
TntRadioButton35: TTntRadioButton;
TntGroupBox29: TTntGroupBox;
TntButton29: TTntButton;
TntComboBox3: TTntComboBox;
TntRadioButton36: TTntRadioButton;
TntGroupBox30: TTntGroupBox;
TntButton30: TTntButton;
TntRadioButton37: TTntRadioButton;
TntRichEdit11: TTntRichEdit;
TntRichEdit12: TTntRichEdit;
TntGroupBox31: TTntGroupBox;
TntButton31: TTntButton;
TntRadioButton38: TTntRadioButton;
TntGroupBox32: TTntGroupBox;
TntButton32: TTntButton;
TntRadioButton39: TTntRadioButton;
TntGroupBox33: TTntGroupBox;
TntButton33: TTntButton;
TntRadioButton40: TTntRadioButton;
TntGroupBox34: TTntGroupBox;
TntButton34: TTntButton;
TntRadioButton41: TTntRadioButton;
TntGroupBox35: TTntGroupBox;
TntButton35: TTntButton;
TntRadioButton42: TTntRadioButton;
TntGroupBox36: TTntGroupBox;
TntButton36: TTntButton;
TntRadioButton43: TTntRadioButton;
TntComboBox4: TTntComboBox;
TntComboBox5: TTntComboBox;
TntComboBox6: TTntComboBox;
TntComboBox7: TTntComboBox;
TntRichEdit13: TTntRichEdit;
TntRichEdit14: TTntRichEdit;
TntGroupBox37: TTntGroupBox;
TntButton37: TTntButton;
TntRadioButton44: TTntRadioButton;
TntGroupBox38: TTntGroupBox;
TntButton38: TTntButton;
TntRadioButton45: TTntRadioButton;
TntGroupBox39: TTntGroupBox;
TntButton39: TTntButton;
TntRadioButton46: TTntRadioButton;
TntPageControl4: TTntPageControl;
TntTabSheet12: TTntTabSheet;
TntRichEdit15: TTntRichEdit;
TntRichEdit16: TTntRichEdit;
TntGroupBox40: TTntGroupBox;
TntButton40: TTntButton;
TntComboBox8: TTntComboBox;
TntRadioButton47: TTntRadioButton;
TntGroupBox41: TTntGroupBox;
TntButton41: TTntButton;
TntComboBox9: TTntComboBox;
TntRadioButton48: TTntRadioButton;
TntGroupBox42: TTntGroupBox;
TntButton42: TTntButton;
TntRadioButton49: TTntRadioButton;
TntGroupBox43: TTntGroupBox;
TntButton43: TTntButton;
TntComboBox10: TTntComboBox;
TntRadioButton50: TTntRadioButton;
TntGroupBox44: TTntGroupBox;
TntButton44: TTntButton;
TntRadioButton51: TTntRadioButton;
TntGroupBox45: TTntGroupBox;
TntButton45: TTntButton;
TntComboBox11: TTntComboBox;
TntRadioButton52: TTntRadioButton;
TntTabSheet13: TTntTabSheet;
TntRichEdit17: TTntRichEdit;
TntRichEdit18: TTntRichEdit;
TntGroupBox46: TTntGroupBox;
TntButton46: TTntButton;
TntRadioButton53: TTntRadioButton;
TntGroupBox47: TTntGroupBox;
TntButton47: TTntButton;
TntRadioButton54: TTntRadioButton;
TntGroupBox48: TTntGroupBox;
TntButton48: TTntButton;
TntRadioButton55: TTntRadioButton;
TntGroupBox49: TTntGroupBox;
TntButton49: TTntButton;
TntComboBox14: TTntComboBox;
TntRadioButton56: TTntRadioButton;
TntGroupBox50: TTntGroupBox;
TntButton50: TTntButton;
TntRadioButton57: TTntRadioButton;
TntGroupBox51: TTntGroupBox;
TntButton51: TTntButton;
TntComboBox15: TTntComboBox;
TntRadioButton58: TTntRadioButton;
TntComboBox12: TTntComboBox;
TntComboBox13: TTntComboBox;
TntPageControl5: TTntPageControl;
TntTabSheet14: TTntTabSheet;
TntRichEdit19: TTntRichEdit;
TntRichEdit20: TTntRichEdit;
TntGroupBox52: TTntGroupBox;
TntButton52: TTntButton;
TntGroupBox53: TTntGroupBox;
TntButton53: TTntButton;
TntGroupBox54: TTntGroupBox;
TntButton54: TTntButton;
TntGroupBox55: TTntGroupBox;
TntButton55: TTntButton;
TntGroupBox56: TTntGroupBox;
TntButton56: TTntButton;
TntGroupBox57: TTntGroupBox;
TntButton57: TTntButton;
TntGroupBox58: TTntGroupBox;
TntButton58: TTntButton;
TntTabSheet15: TTntTabSheet;
TntRichEdit21: TTntRichEdit;
TntRichEdit22: TTntRichEdit;
TntGroupBox59: TTntGroupBox;
TntButton59: TTntButton;
TntGroupBox60: TTntGroupBox;
TntButton60: TTntButton;
procedure TntRadioButton1Click(Sender: TObject);
procedure TntRadioButton2Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure TntButton1Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject;
var Key: Char);
procedure TntRadioButton3Click(Sender: TObject);
procedure TntButton2Click(Sender: TObject);
procedure Edit2KeyPress(Sender: TObject;
var Key: Char);
procedure Edit1Enter(Sender: TObject);
procedure TntFormCreate(Sender: TObject);
procedure Edit3KeyPress(Sender: TObject;
var Key: Char);
procedure TntButton3Click(Sender: TObject);
procedure Edit4Change(Sender: TObject);
procedure Edit4KeyPress(Sender: TObject;
var Key: Char);
procedure TntButton4Click(Sender: TObject);
procedure TntRadioButton5Click(Sender: TObject);
procedure Edit5KeyPress(Sender: TObject;
var Key: Char);
procedure TntButton5Click(Sender: TObject);
procedure Edit7KeyPress(Sender: TObject;
var Key: Char);
procedure TntButton7Click(Sender: TObject);
procedure Edit6KeyPress(Sender: TObject;
var Key: Char);
procedure TntButton6Click(Sender: TObject);
procedure TntRichEdit2Change(Sender: TObject);
procedure TntRichEdit2SelectionChange(Sender: TObject);
procedure TntFormShow(Sender: TObject);
procedure TntRichEdit3SelectionChange(Sender: TObject);
procedure TntButton8Click(Sender: TObject);
procedure TntRadioButton8Click(Sender: TObject);
procedure TntRadioButton7Click(Sender: TObject);
procedure Edit9KeyPress(Sender: TObject;
var Key: Char);
procedure TntRadioButton9Click(Sender: TObject);
procedure Edit10KeyPress(Sender: TObject;
var Key: Char);
procedure TntButton9Click(Sender: TObject);
procedure TntRadioButton11Click(Sender: TObject);
procedure TntRadioButton12Click(Sender: TObject);
procedure Edit11KeyPress(Sender: TObject;
var Key: Char);
procedure TntButton10Click(Sender: TObject);
procedure Edit12KeyPress(Sender: TObject;
var Key: Char);
procedure TntButton11Click(Sender: TObject);
procedure Edit13KeyPress(Sender: TObject;
var Key: Char);
procedure TntButton12Click(Sender: TObject);
procedure TntRadioButton13Click(Sender: TObject);
procedure Edit14KeyPress(Sender: TObject;
var Key: Char);
procedure TntButton13Click(Sender: TObject);
procedure TntRadioButton10Click(Sender: TObject);
procedure TntRadioButton14Click(Sender: TObject);
procedure TntRichEdit1Change(Sender: TObject);
procedure TntRichEdit1SelectionChange(Sender: TObject);
procedure TntRichEdit1DblClick(Sender: TObject);
procedure TntRichEdit4SelectionChange(Sender: TObject);
procedure TntRadioButton4Click(Sender: TObject);
procedure TntRadioButton15Click(Sender: TObject);
procedure TntRadioButton16Click(Sender: TObject);
procedure TntRadioButton6Click(Sender: TObject);
procedure TntRichEdit2DblClick(Sender: TObject);
procedure TntRichEdit5Change(Sender: TObject);
procedure TntRichEdit5DblClick(Sender: TObject);
procedure TntRichEdit5SelectionChange(Sender: TObject);
procedure TntRichEdit6SelectionChange(Sender: TObject);
procedure TntRadioButton17Click(Sender: TObject);
procedure TntRadioButton18Click(Sender: TObject);
procedure TntButton14Click(Sender: TObject);
procedure Edit15KeyPress(Sender: TObject;
var Key: Char);
procedure InitGroupBox7_1;
procedure InitGroupBox7_2;
procedure InitGroupBox7_5;
procedure TntRadioButton19Click(Sender: TObject);
procedure TntRadioButton20Click(Sender: TObject);
procedure TntRadioButton21Click(Sender: TObject);
procedure Edit16KeyPress(Sender: TObject;
var Key: Char);
procedure TntButton15Click(Sender: TObject);
procedure TntButton16Click(Sender: TObject);
procedure TntButton17Click(Sender: TObject);
procedure TntButton18Click(Sender: TObject);
procedure TntButton19Click(Sender: TObject);
procedure TntButton20Click(Sender: TObject);
procedure TntButton21Click(Sender: TObject);
procedure InitGroupBox8_1;
procedure InitGroupBox8_2;
procedure InitGroupBox8_3;
procedure InitGroupBox9_1;
procedure InitGroupBox9_2;
procedure InitGroupBox9_3;
procedure DispBSCommonProc_9(BSType:integer);
procedure InitGroupBox9_4;
procedure InitGroupBox9_5;
procedure InitGroupBox9_6;
procedure InitGroupBox10_1;
procedure InitGroupBox10_2;
procedure InitGroupBox10_3;
procedure DispBSCommonProc_10(BSType:integer);
procedure InitGroupBox10_4;
procedure InitGroupBox10_5;
procedure InitGroupBox10_6;
procedure DispBSCommonProc_11(BSType:integer);
procedure InitGroupBox11_4;
procedure InitGroupBox11_5;
procedure InitGroupBox11_6;
procedure InitGroupBox12_1;
procedure InitGroupBox12_2;
procedure InitGroupBox12_3;
procedure DispBSCommonProc_12(BSType:integer);
procedure InitGroupBox12_4;
procedure InitGroupBox12_5;
procedure InitGroupBox12_6;
procedure InitGroupBox13_1;
procedure InitGroupBox13_2;
procedure InitGroupBox13_3;
procedure DispBSCommonProc_13(BSType:integer);
procedure InitGroupBox13_4;
procedure InitGroupBox13_5;
procedure InitGroupBox13_6;
procedure DispBSCommonProc_14(BSType:integer);
procedure DispBSCommonProc_15(BSType:integer);
procedure TntRichEdit7Change(Sender: TObject);
procedure TntRichEdit7DblClick(Sender: TObject);
procedure TntRichEdit7SelectionChange(Sender: TObject);
procedure TntRichEdit8SelectionChange(Sender: TObject);
procedure TntRadioButton29Click(Sender: TObject);
procedure TntButton22Click(Sender: TObject);
procedure TntButton23Click(Sender: TObject);
procedure TntButton24Click(Sender: TObject);
procedure TntTabSheet9Show(Sender: TObject);
procedure TntTabSheet5Show(Sender: TObject);
procedure TntTabSheet6Show(Sender: TObject);
procedure TntTabSheet7Show(Sender: TObject);
procedure TntTabSheet8Show(Sender: TObject);
procedure TntTabSheet1Show(Sender: TObject);
procedure TntRichEdit9Change(Sender: TObject);
procedure TntRichEdit9DblClick(Sender: TObject);
procedure TntRichEdit9SelectionChange(Sender: TObject);
procedure TntRichEdit10SelectionChange(Sender: TObject);
procedure TntButton25Click(Sender: TObject);
procedure TntRadioButton32Click(Sender: TObject);
procedure TntButton26Click(Sender: TObject);
procedure TntButton27Click(Sender: TObject);
procedure TntButton28Click(Sender: TObject);
procedure TntButton29Click(Sender: TObject);
procedure TntButton30Click(Sender: TObject);
procedure TntTabSheet10Show(Sender: TObject);
procedure TntRichEdit11Change(Sender: TObject);
procedure TntRadioButton38Click(Sender: TObject);
procedure TntRichEdit11DblClick(Sender: TObject);
procedure TntRichEdit11SelectionChange(Sender: TObject);
procedure TntRichEdit12SelectionChange(Sender: TObject);
procedure TntButton31Click(Sender: TObject);
procedure TntButton32Click(Sender: TObject);
procedure TntButton33Click(Sender: TObject);
procedure TntButton34Click(Sender: TObject);
procedure TntButton35Click(Sender: TObject);
procedure TntButton36Click(Sender: TObject);
procedure TntTabSheet11Show(Sender: TObject);
procedure TntRadioButton44Click(Sender: TObject);
procedure TntRichEdit13Change(Sender: TObject);
procedure TntRichEdit13DblClick(Sender: TObject);
procedure TntRichEdit13SelectionChange(Sender: TObject);
procedure TntRichEdit14SelectionChange(Sender: TObject);
procedure TntButton37Click(Sender: TObject);
procedure TntButton38Click(Sender: TObject);
procedure TntButton39Click(Sender: TObject);
procedure TntTabSheet12Show(Sender: TObject);
procedure TntRichEdit15Change(Sender: TObject);
procedure TntRichEdit15DblClick(Sender: TObject);
procedure TntRichEdit15SelectionChange(Sender: TObject);
procedure TntRichEdit16SelectionChange(Sender: TObject);
procedure TntRadioButton47Click(Sender: TObject);
procedure TntButton40Click(Sender: TObject);
procedure TntButton41Click(Sender: TObject);
procedure TntButton42Click(Sender: TObject);
procedure TntButton43Click(Sender: TObject);
procedure TntButton44Click(Sender: TObject);
procedure TntButton45Click(Sender: TObject);
procedure TntTabSheet13Show(Sender: TObject);
procedure TntRichEdit17Change(Sender: TObject);
procedure TntRichEdit17DblClick(Sender: TObject);
procedure TntRichEdit17SelectionChange(Sender: TObject);
procedure TntRichEdit18SelectionChange(Sender: TObject);
procedure TntRadioButton53Click(Sender: TObject);
procedure TntButton46Click(Sender: TObject);
procedure TntButton47Click(Sender: TObject);
procedure TntComboBox12Select(Sender: TObject);
procedure TntButton48Click(Sender: TObject);
procedure TntButton49Click(Sender: TObject);
procedure TntButton50Click(Sender: TObject);
procedure TntButton51Click(Sender: TObject);
procedure TntTabSheet14Show(Sender: TObject);
procedure TntRichEdit19SelectionChange(Sender: TObject);
procedure TntRichEdit20SelectionChange(Sender: TObject);
procedure TntRichEdit19Change(Sender: TObject);
procedure TntButton52Click(Sender: TObject);
procedure TntButton53Click(Sender: TObject);
procedure TntButton54Click(Sender: TObject);
procedure TntButton55Click(Sender: TObject);
procedure TntButton56Click(Sender: TObject);
procedure TntButton57Click(Sender: TObject);
procedure TntButton58Click(Sender: TObject);
procedure TntTabSheet15Show(Sender: TObject);
procedure TntRichEdit21Change(Sender: TObject);
procedure TntRichEdit21SelectionChange(Sender: TObject);
procedure TntRichEdit22SelectionChange(Sender: TObject);
procedure TntButton59Click(Sender: TObject);
procedure TntButton60Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
TmpUTF8Str:string;
// 临时UTF-8字符串
TmpUTF32Str:array of DWORD;
// 临时UTF-32字符串
TmpUTFBS:string;
// 临时Unicode编码格式字节序列
// 单选框控件数组
RadioBtnArray:array of TTntRadioButton;
// 分组框控件数组
GroupBoxArray:array of TTntGroupBox;
EnabGroupBoxIndex:integer;
// 当前可用分组框在数组中的索引
implementation
{$R *.dfm}
procedure TForm1.TntRadioButton1Click(Sender: TObject);
begin
Edit1.SetFocus;
Edit1.Text:='';
Edit1.OnChange(Edit1)
end;
procedure TForm1.TntRadioButton2Click(Sender: TObject);
begin
TntRichEdit4.SetFocus;
TntRichEdit4.OnSelectionChange(TntRichEdit4);
TntButton1.Enabled:=true
end;
procedure TForm1.Edit1Change(Sender: TObject);
var
s:string;
i,j,k:integer;
Edit:TEdit;
begin
if (Sender<>nil) and (Sender is TEdit) then
begin
Edit:=Sender as TEdit;
if Edit.Tag=0 then
begin
s:='';
k:=0;
j:=0;
i:=1;
While i<=Length(Edit.Text)do
case ord(ByteType(Edit.Text,i)) of
0:
begin
if Edit.Text
in ['0'..'9'] then
s:=s+Edit.Text
else
begin
k:=i-j;
inc(j)
end;
inc(i)
end;
1:
begin
k:=i-j;
j:=j+2;
i:=i+2
end
else
begin
k:=i-j;
Break
end
end;
if k>0 then
begin
Edit.Tag:=1;
Edit.Text:=s;
Edit.SelStart:=k-1
end
end
else
Edit.Tag:=0;
if Edit=Edit1 then
TntButton1.Enabled:=Edit.Text<>'';
if Edit=Edit2 then
TntButton2.Enabled:=Edit.Text<>'';
if Edit=Edit3 then
TntButton3.Enabled:=Edit.Text<>'';
if Edit=Edit5 then
TntButton5.Enabled:=Edit.Text<>'';
if Edit=Edit9 then
TntButton8.Enabled:=Edit.Text<>'';
if Edit=Edit10 then
TntButton9.Enabled:=Edit.Text<>'';
if Edit=Edit11 then
TntButton10.Enabled:=Edit.Text<>'';
if Edit=Edit14 then
TntButton13.Enabled:=Edit.Text<>'';
if Edit=Edit15 then
TntButton14.Enabled:=Edit.Text<>'';
if Edit=Edit16 then
TntButton15.Enabled:=Edit.Text<>''
end
end;
procedure TForm1.TntButton1Click(Sender: TObject);
var
s:WideString;
i:integer;
begin
if TntRadioButton1.Checked then
begin
case TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit1.Text),strtoint(
Edit1.Text))) of
BMPCP:
s:='BMP编码点';
HighSurr:
s:='高位代理';
LowSurr:
s:='低位代理'
else
s:='无效编码单元'
end;
s:='第'+Edit1.Text+'个编码单元的类型是'+s;
MessageBoxW(Form1.Handle,Pointer(s),'试练UTF16CodeUnitType函数',mb_ok);
Edit1.SetFocus
end
else
begin
TntRadioButton2.OnClick(TntRadioButton2);
i:=TntRichEdit4.SelStart div 5 + 1;
case TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit1.Text),i)) of
BMPCP:
s:='BMP编码点';
HighSurr:
s:='高位代理';
LowSurr:
s:='低位代理'
else
s:='无效编码单元'
end;
s:='第'+inttostr(i)+'个编码单元的类型是'+s;
MessageBoxW(Form1.Handle,Pointer(s),'试练UTF16CodeUnitType函数',mb_ok);
TntRichEdit1.SetFocus
end
end;
procedure TForm1.Edit1KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
if TntButton1.Enabled then
TntButton1.Click
end
end;
procedure TForm1.TntRadioButton3Click(Sender: TObject);
begin
Edit2.SetFocus;
Edit2.Text:='';
Edit2.OnChange(Edit2)
end;
procedure TForm1.TntButton2Click(Sender: TObject);
var
s:WideString;
i:integer;
begin
if TntRadioButton3.Checked then
begin
s:='第'+Edit2.Text+'个编码单元属于第'+inttostr(UTF16CUToCharIndex(
Pointer(TntRichEdit1.Text),strtoint(Edit2.Text),true))+'个字符';
MessageBoxW(Form1.Handle,Pointer(s),'试练UTF16CUToCharIndex函数',mb_ok);
Edit2.SetFocus
end
else
begin
TntRadioButton4.OnClick(TntRichEdit4);
i:=TntRichEdit4.SelStart div 5 + 1;
s:='第'+inttostr(i)+'个编码单元属于第'+inttostr(UTF16CUToCharIndex(
Pointer(TntRichEdit1.Text),i,true))+'个字符';
MessageBoxW(Form1.Handle,Pointer(s),'试练UTF16CUToCharIndex函数',mb_ok);
TntRichEdit4.SetFocus
end
end;
procedure TForm1.Edit2KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
if TntButton2.Enabled then
TntButton2.Click
end
end;
procedure TForm1.Edit1Enter(Sender: TObject);
begin
if (Sender<>nil) and (Sender is TEdit) then
(Sender as TEdit).SelectAll
end;
procedure TForm1.TntFormCreate(Sender: TObject);
begin
Application.HintHidePause:=10000
end;
procedure TForm1.Edit3KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
if TntButton3.Enabled then
TntButton3.Click
end
end;
procedure TForm1.TntButton3Click(Sender: TObject);
var
s:WideString;
i:integer;
begin
if TntRadioButton15.Checked then
begin
s:='第'+Edit3.Text+'个字符的第一个编码单元是字符串中的第'+inttostr(
UTF16CharToCUIndex(Pointer(TntRichEdit1.Text),strtoint(Edit3.Text),true))+
'个编码单元';
MessageBoxW(Form1.Handle,Pointer(s),'试练UTF16CharToCUIndex函数',mb_ok);
Edit3.SetFocus
end
else
begin
TntRadioButton16.OnClick(TntRadioButton16);
i:=UTF16CUToCharIndex(Pointer(TntRichEdit1.Text),TntRichEdit1.SelStart+1,
true);
s:='第'+inttostr(i)+'个字符的第一个编码单元是字符串中的第'+inttostr(
UTF16CharToCUIndex(Pointer(TntRichEdit1.Text),i,true))+'个编码单元';
MessageBoxW(Form1.Handle,Pointer(s),'试练UTF16CharToCUIndex函数',mb_ok);
TntRichEdit1.SetFocus
end
end;
procedure TForm1.Edit4Change(Sender: TObject);
var
s:string;
i,j,k:integer;
Edit:TEdit;
begin
if (Sender<>nil) and (Sender is TEdit) then
begin
Edit:=Sender as TEdit;
if Edit.Tag=0 then
begin
s:='';
i:=1;
j:=0;
k:=0;
While i<=Length(Edit.Text)do
case ord(ByteType(Edit.Text,i)) of
0:
begin
if Edit.Text in ['0'..'9','A'..'F'] then
s:=s+Edit.Text
else
begin
k:=i-j;
inc(j)
end;
inc(i)
end;
1:
begin
k:=i-j;
j:=j+2;
i:=i+2
end
else
begin
k:=i-j;
Break
end
end;
if j>0 then
begin
Edit.Tag:=1;
Edit.Text:=s;
Edit.SelStart:=k-1
end
end
else
Edit.Tag:=0;
if Edit=Edit4 then
TntButton4.Enabled:=Edit.Text<>'';
if (Edit=Edit7) or (Edit=Edit8) then
TntButton7.Enabled:=(Edit7.Text<>'') and (Edit8.Text<>'');
if Edit=Edit6 then
TntButton6.Enabled:=Edit.Text<>'';
if Edit=Edit12 then
TntButton11.Enabled:=Edit.Text<>'';
if Edit=Edit13 then
TntButton12.Enabled:=Edit.Text<>''
end
end;
procedure TForm1.Edit4KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
if TntButton4.Enabled then
TntButton4.Click
end
end;
procedure TForm1.TntButton4Click(Sender: TObject);
var
UTF16_CUS:array [0..2] of WideChar;
i:integer;
s:WideString;
begin
s:='';
for i:=0 to CPToUTF16CUS(UTF16_CUS,strtoint('$'+Edit4.Text))-1do
begin
if i>0 then
s:=s+WideChar(' ');
s:=s+inttohex(ord(UTF16_CUS),1)
end;
if s<>'' then
s:='Unicode编码点数字U+'+Edit4.Text+'对应的UTF16编码单元序列是<'+s+'>'
else
s:='0x'+Edit4.Text+s+'不是一个有效的Unicode编码点数字';
MessageBoxW(Form1.Handle,Pointer(s),'试练CPToUTF16CUS函数',mb_ok);
Edit4.SetFocus
end;
procedure TForm1.TntRadioButton5Click(Sender: TObject);
begin
Edit5.SetFocus;
Edit5.Text:='';
Edit5.OnChange(Edit5)
end;
procedure TForm1.Edit5KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
if TntButton5.Enabled then
TntButton5.Click
end
end;
procedure TForm1.TntButton5Click(Sender: TObject);
var
CPWORD;
s:WideString;
i:integer;
begin
if TntRadioButton5.Checked then
begin
CP:=UTF16CUSToCP(Pointer(TntRichEdit1.Text),strtoint(Edit5.Text));
if CP<>$FFFFFFFF then
s:='第'+Edit5.Text+'个编码单元所属的字符的Unicode编码点数字是U+'+
inttohex(CP,1)
else
s:='第'+Edit5.Text+'个编码单元所属的子编码单元序列是一个无效编码单元'+
'序列';
MessageBoxW(Form1.Handle,Pointer(s),'试练UTF16CUToCP函数',mb_ok);
Edit5.SetFocus
end
else
begin
TntRadioButton6.OnClick(TntRadioButton6);
i:=TntRichEdit4.SelStart div 5 + 1;
CP:=UTF16CUSToCP(Pointer(TntRichEdit1.Text),i);
if CP<>$FFFFFFFF then
s:='第'+inttostr(i)+'个编码单元所属的字符的'+
'Unicode编码点数字是U+'+inttohex(CP,1)
else
s:='第'+inttostr(i)+'个编码单元所属的子编码'+'单元序列是一个无效编码单'+
'元序列';
MessageBoxW(Form1.Handle,Pointer(s),'试练UTF16CUToCP函数',mb_ok);
TntRichEdit4.SetFocus
end
end;
procedure TForm1.Edit7KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
if TntButton7.Enabled then
TntButton7.Click
end
end;
procedure TForm1.TntButton7Click(Sender: TObject);
var
CPWORD;
s:WideString;
begin
CP:=SurrPairToCP(strtoint('$'+Edit7.Text),strtoint('$'+Edit8.Text));
if CP<>$FFFFFFFF then
s:='代理对<'+Edit7.Text+#32+Edit8.Text+'>对应的Unicode编码点数字是U+'+
inttohex(CP,1)
else
s:='<'+Edit7.Text+#32+Edit8.Text+'>不是一个有效的代理对';
MessageBoxW(Form1.Handle,Pointer(s),'试练SurrPairToCP函数',mb_ok)
end;
procedure TForm1.Edit6KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
if TntButton6.Enabled then
TntButton6.Click
end
end;
procedure TForm1.TntButton6Click(Sender: TObject);
var
s:WideString;
SurrPair,CPWORD;
HighSurr,LowSurr:WORD;
begin
CP:=strtoint('$'+Edit6.Text);
SurrPair:=CPToSurrPair(CP);
if SurrPair>MaxBMPCP then
begin
HighSurr:=SurrPair shr 16;
LowSurr:=SurrPair;
s:='增补Unicode编码点数字U+'+Edit6.Text+'对应的代理对是<'+inttohex(
HighSurr,4)+#32+inttohex(LowSurr,4)+'>'
end
else
if CP<=MaxUnicodeValue then
s:='U+'+Edit6.Text+'不是有效的增补Unicode编码点数字'
else
s:='0x'+Edit6.Text+'不是不是有效的Unicode编码点';
MessageBoxW(Form1.Handle,Pointer(s),'试练CPToSurrPair函数',mb_ok)
end;
procedure TForm1.TntRichEdit2Change(Sender: TObject);
var
i,l,j:integer;
s,s1:string;
psChar;
b,b1:Byte;
begin
TntRichEdit3.Clear;
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),nil);
if i>0 then
begin
SetLength(s1,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),Pointer(s1))=i then
begin
l:=i*3;
SetLength(s,l);
ps:=Pointer(s);
j:=0;
for i:=1 to Length(s1)do
begin
b:=Ord(s1);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
ps[j]:=Chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
ps[j+1]:=Chr(b1);
ps[j+2]:=#32;
j:=j+3
end;
TntRichEdit3.Text:=s
end
end
end;
procedure TForm1.TntRichEdit2SelectionChange(Sender: TObject);
var
i,j,k:integer;
s:string;
begin
if TntRichEdit2.ReadOnly then
if TntRichEdit2.Tag=0 then
begin
TntRichEdit2.Tag:=1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit2.Text),
TntRichEdit2.SelStart+1))=BMPCP
then
TntRichEdit2.SelLength:=1
else
TntRichEdit2.SelLength:=2;
i:=UTF16ToUTF8ForStr(Pointer(TntRichedit2.Text),nil);
if i>0 then
begin
SetLength(s,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),Pointer(s))=i then
begin
i:=UTF8CharToCUIndex(Pointer(s),UTF16CUToCharIndex(Pointer(
TntRichEdit2.Text),TntRichEdit2.SelStart+1,true),true);
if (i<=Length(s)) and (UTF8CUIndexOfChar(Pointer(s),i,@j,@k)=1) then
begin
TntRichEdit3.Tag:=1;
TntRichEdit3.SelStart:=(i-1)*3;
TntRichEdit3.SelLength:=(k-1)*3+2
end
end
end
end
else
if TntRichEdit2.SelLength>0 then
TntRichEdit2.Tag:=0
end;
procedure TForm1.TntFormShow(Sender: TObject);
var
i,j,k:integer;
begin
for i:=TntPageControl1.PageCount-1do
wnto 0do
begin
TntPageControl1.ActivePageIndex:=i;
for j:=TntPageControl1.ActivePage.ControlCount-1do
wnto 0do
if TntPageControl1.ActivePage.Controls[j] is TTntPageControl then
for k:=(TntPageControl1.ActivePage.Controls[j] as
TTntPageControl).PageCount-1do
wnto 0do
(TntPageControl1.ActivePage.Controls[j] as
TTntPageControl).ActivePageIndex:=k
end
end;
procedure TForm1.TntRichEdit3SelectionChange(Sender: TObject);
var
i,j:integer;
s:string;
begin
if TntRichEdit3.Tag=0 then
begin
i:=TntRichEdit3.SelStart div 3 + 1;
TntRichEdit3.Tag:=1;
TntRichEdit3.SelStart:=(i-1)*3;
TntRichEdit3.SelLength:=2;
j:=UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),nil);
if j>0 then
begin
SetLength(s,j);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),Pointer(s))=j then
begin
i:=UTF8CUToCharIndex(Pointer(s),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit2.Text),i,true);
TntRichEdit2.Tag:=1;
TntRichEdit2.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit2.Text),i))
=BMPCP
then
TntRichEdit2.SelLength:=1
else
TntRichEdit2.SelLength:=2;
TntRichEdit2.Tag:=0
end
end
end
else
if TntRichEdit3.SelLength>0 then
TntRichEdit3.Tag:=0
end;
procedure TForm1.TntButton8Click(Sender: TObject);
var
i,j,k,charsize:integer;
s:string;
s1:WideString;
begin
if TntRadioButton7.Checked then
begin
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),nil);
if i>0 then
begin
SetLength(s,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),Pointer(s))=i then
begin
i:=strtoint(Edit9.Text);
k:=UTF8CUToCharIndex(Pointer(s),i,true);
i:=UTF8CUIndexOfChar(Pointer(s),i,@j,@charsize);
s1:='字符串的第'+Edit9.Text+'个编码单元是第'+inttostr(k)+'个字符的第'+
inttostr(i)+'个编码单元;'+CRLF+'第'+inttostr(k)+
'个字符位于UTF-8编码点分段的第'+inttostr(j)+'段;'+CRLF+
'第'+inttostr(k)+'个字符的编码单元序列长度为'+inttostr(charsize);
MessageBoxW(Form1.Handle,Pointer(s1),'试练UTF8CUIndexOfChar函数',mb_ok)
end
end;
Edit9.SetFocus
end
else
begin
TntRichEdit3.OnSelectionChange(TntRichEdit3);
TntRichEdit3.SetFocus;
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),nil);
if i>0 then
begin
SetLength(s,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),Pointer(s))=i then
begin
i:=TntRichEdit3.SelStart div 3 + 1;
k:=UTF8CUToCharIndex(Pointer(s),i,true);
i:=UTF8CUIndexOfChar(Pointer(s),i,@j,@charsize);
s1:='字符串的第'+inttostr(TntRichEdit3.SelStart div 3 + 1)+
'个编码单元是第'+inttostr(k)+'个字符的第'+inttostr(i)+'个编码单元;'+
CRLF+'第'+inttostr(k)+'个字符位于UTF-8编码点分段的第'+inttostr(j)+
'段;'+CRLF+'第'+inttostr(k)+'个字符的编码单元序列长度为'+
inttostr(charsize);
MessageBoxW(Form1.Handle,Pointer(s1),'试练UTF8CUIndexOfChar函数',mb_ok)
end
end
end
end;
procedure TForm1.TntRadioButton8Click(Sender: TObject);
begin
TntRichEdit3.SetFocus;
TntRichEdit3.OnSelectionChange(TntRichEdit3);
TntButton8.Enabled:=true
end;
procedure TForm1.TntRadioButton7Click(Sender: TObject);
begin
Edit9.SetFocus;
Edit9.Text:='';
Edit9.OnChange(Edit9)
end;
procedure TForm1.Edit9KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
if TntButton8.Enabled then
TntButton8.Click
end
end;
procedure TForm1.TntRadioButton9Click(Sender: TObject);
begin
Edit10.SetFocus;
Edit10.Text:='';
Edit10.OnChange(Edit10)
end;
procedure TForm1.Edit10KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
if TntButton9.Enabled then
TntButton9.Click
end
end;
procedure TForm1.TntButton9Click(Sender: TObject);
var
i:integer;
s:string;
s1:WideString;
begin
if TntRadioButton9.Checked then
begin
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),nil);
if i>0 then
begin
SetLength(s,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),Pointer(s))=i then
begin
s1:='字符串的第'+Edit10.Text+'个编码单元属于第'+inttostr(
UTF8CUToCharIndex(Pointer(s),strtoint(Edit10.Text),true))+'个字符';
MessageBoxW(Form1.Handle,Pointer(s1),'试练UTF8CUToCharIndex函数',mb_ok)
end
end;
Edit10.SetFocus
end
else
begin
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),nil);
if i>0 then
begin
SetLength(s,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),Pointer(s))=i then
begin
i:=TntRichEdit3.SelStart div 3 + 1;
s1:='字符串的第'+inttostr(i)+'个编码单元属于第'+inttostr(
UTF8CUToCharIndex(Pointer(s),i,true))+'个字符';
MessageBoxW(Form1.Handle,Pointer(s1),'试练UTF8CUToCharIndex函数',mb_ok)
end
end;
TntRichEdit3.SetFocus
end
end;
procedure TForm1.TntRadioButton11Click(Sender: TObject);
begin
Edit11.SetFocus;
Edit11.Text:='';
Edit11.OnChange(Edit11)
end;
procedure TForm1.TntRadioButton12Click(Sender: TObject);
begin
TntRichEdit2.SetFocus;
TntRichEdit2.OnSelectionChange(TntRichEdit2);
TntButton10.Enabled:=true
end;
procedure TForm1.Edit11KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
if TntButton10.Enabled then
TntButton10.Click
end
end;
procedure TForm1.TntButton10Click(Sender: TObject);
var
i:integer;
s:string;
s1:WideString;
begin
if TntRadioButton11.Checked then
begin
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),nil);
if i>0 then
begin
SetLength(s,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),Pointer(s))=i then
begin
s1:='字符串的第'+Edit11.Text+'个字符的第一个编码单元是字符串的第'+
inttostr(UTF8CharToCUIndex(Pointer(s),strtoint(Edit11.Text),true))+
'个编码单元';
MessageBoxW(Form1.Handle,Pointer(s1),'试练UTF8CharToCUIndex函数',mb_ok)
end
end;
Edit11.SetFocus
end
else
begin
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),nil);
if i>0 then
begin
SetLength(s,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),Pointer(s))=i then
begin
i:=UTF16CUToCharIndex(Pointer(TntRichEdit2.Text),
TntRichEdit2.SelStart+1,true);
s1:='字符串的第'+inttostr(i)+'个字符的第一个编码单元是字符串的第'+
inttostr(UTF8CharToCUIndex(Pointer(s),i,true))+'个编码单元';
MessageBoxW(Form1.Handle,Pointer(s1),'试练UTF8CharToCUIndex函数',mb_ok)
end
end;
TntRichEdit2.SetFocus
end
end;
procedure TForm1.Edit12KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
if TntButton11.Enabled then
TntButton11.Click
end
end;
procedure TForm1.TntButton11Click(Sender: TObject);
var
i:integer;
s:string;
s1:WideString;
cpWORD;
b,b1:Byte;
begin
cp:=strtoint('$'+Edit12.Text);
i:=CPToUTF8CUS(nil,cp);
if i>0 then
begin
SetLength(s,i);
if CPToUTF8CUS(Pointer(s),cp)=i then
begin
s1:='';
for i:=1 to ido
begin
if i>1 then
s1:=s1+#32;
b:=ord(s);
b1:=b shr 4;
if b1>9 then
s1:=s1+chr(b1+$37)
else
s1:=s1+chr(b1+$30);
b1:=b and $F;
if b1>9 then
s1:=s1+chr(b1+$37)
else
s1:=s1+chr(b1+$30)
end;
s1:='Unicode编码点数字U+'+Edit12.Text+'对应的UTF-8编码单元序列是<'+s1+
'>';
MessageBoxW(Form1.Handle,Pointer(s1),'试练CPToUTF8CUS函数',mb_ok)
end
end
else
begin
s1:='0x'+Edit12.Text+'不是一个有效的Unicode编码点数字';
MessageBoxW(Form1.Handle,Pointer(s1),'试练GetCPPartIndexOfUTF8函数',mb_ok)
end;
Edit12.SetFocus
end;
procedure TForm1.Edit13KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
if TntButton12.Enabled then
TntButton12.Click
end
end;
procedure TForm1.TntButton12Click(Sender: TObject);
var
CPPartOfUTF8Info:TCPPartOfUTF8Info;
i,j:integer;
s:WideString;
b:Byte;
begin
i:=GetCPPartIndexOfUTF8(strtoint('$'+Edit13.Text),@CPPartOfUTF8Info);
if i in [0..CPPartCountOfUTF8-1] then
With CPPartOfUTF8Infodo
begin
s:='Unicode编码点数字U+'+Edit13.Text+'位于UTF-8编码点分段的第'+
inttostr(i)+'段,该分段的属性为:'+CRLF+CRLF+#9'编码点区间 - [U+'+
inttohex(CodeRange.MinCode,1)+',U+'+inttohex(CodeRange.MaxCode,1)+']'+
CRLF+CRLF;
for j:=0 to MaxCodeUnitCountOfUTF8-1do
if (CUValueRange[j].MinValue in InvalUTF8CUSet)
or
(CUValueRange[j].MaxValue in InvalUTF8CUSet)
then
Break
else
begin
if j>0 then
s:=s+CRLF;
b:=CUValueRange[j].MinValue shr 4;
if b>9 then
s:=s+#9'第'+inttostr(j+1)+'个编码单元的取值范围 - ['+chr(b+$37)
else
s:=s+#9'第'+inttostr(j+1)+'个编码单元的取值范围 - ['+chr(b+$30);
b:=CUValueRange[j].MinValue and $F;
if b>9 then
s:=s+chr(b+$37)+','
else
s:=s+chr(b+$30)+',';
b:=CUValueRange[j].MaxValue shr 4;
if b>9 then
s:=s+chr(b+$37)
else
s:=s+chr(b+$30);
b:=CUValueRange[j].MaxValue and $F;
if b>9 then
s:=s+chr(b+$37)+']'
else
s:=s+chr(b+$30)+']'
end;
MessageBoxW(Form1.Handle,Pointer(s),'试练GetCPPartIndexOfUTF8函数',mb_ok)
end
else
begin
s:='0x'+Edit13.Text+'不是一个有效的Unicode编码点数字';
MessageBoxW(Form1.Handle,Pointer(s),'试练GetCPPartIndexOfUTF8函数',mb_ok)
end;
Edit13.SetFocus
end;
procedure TForm1.TntRadioButton13Click(Sender: TObject);
begin
Edit14.SetFocus;
Edit14.Text:='';
Edit14.OnChange(Edit14)
end;
procedure TForm1.Edit14KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
if TntButton13.Enabled then
TntButton13.Click
end
end;
procedure TForm1.TntButton13Click(Sender: TObject);
var
CPWORD;
s:string;
s1:WideString;
i:integer;
begin
if TntRadioButton13.Checked then
begin
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),nil);
if i>0 then
begin
SetLength(s,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),Pointer(s))=i then
begin
CP:=UTF8CUSToCP(Pointer(s),strtoint('$'+Edit14.Text));
if CP<>$FFFFFFFF then
begin
s1:='字符串的第'+Edit14.Text+'个编码单元所属的字符对应的Unicode'+
'编码点数字是U+'+inttohex(CP,1);
MessageBoxW(Form1.Handle,Pointer(s1),'试练UTF8CUSToCP函数',mb_ok)
end
end
end;
Edit14.SetFocus
end
else
begin
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),nil);
if i>0 then
begin
SetLength(s,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit2.Text),Pointer(s))=i then
begin
i:=TntRichEdit3.SelStart div 3 + 1;
CP:=UTF8CUSToCP(Pointer(s),i);
if CP<>$FFFFFFFF then
begin
s1:='字符串的第'+inttostr(i)+'个编码单元所属的字符对应的Unicode'+
'编码点数字是U+'+inttohex(CP,1);
MessageBoxW(Form1.Handle,Pointer(s1),'试练UTF8CUSToCP函数',mb_ok)
end
end
end;
TntRichEdit3.SetFocus
end
end;
procedure TForm1.TntRadioButton10Click(Sender: TObject);
begin
TntRichEdit3.SetFocus;
TntRichEdit3.OnSelectionChange(TntRichEdit3);
TntButton9.Enabled:=true
end;
procedure TForm1.TntRadioButton14Click(Sender: TObject);
begin
TntRichEdit3.SetFocus;
TntRichEdit3.OnSelectionChange(TntRichEdit3);
TntButton13.Enabled:=true
end;
procedure TForm1.TntRichEdit1Change(Sender: TObject);
var
pWideChar;
i,j,k:integer;
s:string;
psChar;
CU:WORD;
b:Byte;
begin
p:=Pointer(TntRichEdit1.Text);
SetLength(s,5*Length(TntRichEdit1.Text));
ps:=Pointer(s);
j:=0;
for i:=0 to Length(TntRichEdit1.Text)-1do
begin
CU:=ord(p);
for k:=3do
wnto 0do
begin
b:=CU shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
ps[j]:=chr(b);
inc(j)
end;
ps[j]:=#32;
inc(j)
end;
TntRichEdit4.Text:=s
end;
procedure TForm1.TntRichEdit1SelectionChange(Sender: TObject);
begin
if TntRichEdit1.ReadOnly then
if TntRichEdit1.Tag=0 then
begin
TntRichEdit1.Tag:=1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit1.Text),
TntRichEdit1.SelStart+1))=BMPCP
then
TntRichEdit1.SelLength:=1
else
TntRichEdit1.SelLength:=2;
TntRichEdit4.Tag:=1;
TntRichEdit4.SelStart:=TntRichEdit1.SelStart*5;
if TntRichEdit1.SelLength=1 then
TntRichEdit4.SelLength:=4
else
TntRichEdit4.SelLength:=9
end
else
if TntRichEdit1.SelLength>0 then
TntRichEdit1.Tag:=0
end;
procedure TForm1.TntRichEdit1DblClick(Sender: TObject);
begin
TntRichEdit1.ReadOnly:=not TntRichEdit1.ReadOnly;
if TntRichEdit1.ReadOnly then
begin
TntRichEdit1.Cursor:=crArrow;
TntRichEdit1.OnSelectionChange(TntRichEdit1)
end
else
begin
TntRichEdit1.Cursor:=crDefault;
TntRichEdit1.SelLength:=0
end;
TntRichEdit4.HideSelection:=not TntRichEdit1.ReadOnly;
TntRichEdit1.Tag:=0
end;
procedure TForm1.TntRichEdit4SelectionChange(Sender: TObject);
var
i,j:integer;
begin
if TntRichEdit4.Tag=0 then
begin
i:=TntRichEdit4.SelStart div 5 + 1;
TntRichEdit4.Tag:=1;
TntRichEdit4.SelStart:=(i-1)*5;
TntRichEdit4.SelLength:=4;
j:=UTF16CUIndexOfChar(Pointer(TntRichEdit1.Text),i,@j);
TntRichEdit1.Tag:=1;
TntRichEdit1.SelStart:=i-j;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit1.Text),i))=BMPCP then
TntRichEdit1.SelLength:=1
else
TntRichEdit1.SelLength:=2;
TntRichEdit1.Tag:=0
end
else
if TntRichEdit4.SelLength>0 then
TntRichEdit4.Tag:=0
end;
procedure TForm1.TntRadioButton4Click(Sender: TObject);
begin
TntRichEdit4.SetFocus;
TntRichEdit4.OnSelectionChange(TntRichEdit4);
TntButton2.Enabled:=true
end;
procedure TForm1.TntRadioButton15Click(Sender: TObject);
begin
Edit3.SetFocus;
Edit3.Text:='';
Edit3.OnChange(Edit3)
end;
procedure TForm1.TntRadioButton16Click(Sender: TObject);
begin
TntRichEdit1.SetFocus;
TntRichEdit1.OnSelectionChange(TntRichEdit4);
TntButton3.Enabled:=true
end;
procedure TForm1.TntRadioButton6Click(Sender: TObject);
begin
TntRichEdit4.SetFocus;
TntRichEdit4.OnSelectionChange(TntRichEdit4);
TntButton5.Enabled:=true
end;
procedure TForm1.TntRichEdit2DblClick(Sender: TObject);
begin
TntRichEdit2.ReadOnly:=not TntRichEdit2.ReadOnly;
if TntRichEdit2.ReadOnly then
begin
TntRichEdit2.Cursor:=crArrow;
TntRichEdit2.OnSelectionChange(TntRichEdit2)
end
else
begin
TntRichEdit2.Cursor:=crDefault;
TntRichEdit2.SelLength:=0
end;
TntRichEdit3.HideSelection:=not TntRichEdit2.ReadOnly;
TntRichEdit2.Tag:=0
end;
procedure TForm1.TntRichEdit5Change(Sender: TObject);
begin
case EnabGroupBoxIndex of
0,2,4:
InitGroupBox7_1;
1,3,6:
InitGroupBox7_2;
5,7:
InitGroupBox7_5
end
end;
procedure TForm1.TntRichEdit5DblClick(Sender: TObject);
begin
TntRichEdit5.ReadOnly:=not TntRichEdit5.ReadOnly;
if TntRichEdit5.ReadOnly then
begin
TntRichEdit5.Cursor:=crArrow;
TntRichEdit5.OnSelectionChange(TntRichEdit5)
end
else
begin
TntRichEdit5.Cursor:=crDefault;
TntRichEdit5.SelLength:=0
end;
TntRichEdit6.HideSelection:=not TntRichEdit5.ReadOnly;
TntRichEdit5.Tag:=0
end;
procedure TForm1.TntRichEdit5SelectionChange(Sender: TObject);
var
i,j,charsize:integer;
begin
if TntRichEdit5.ReadOnly then
if TntRichEdit5.Tag=0 then
begin
TntRichEdit5.Tag:=1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit5.Text),
TntRichEdit5.SelStart+1))=BMPCP
then
TntRichEdit5.SelLength:=1
else
TntRichEdit5.SelLength:=2;
if TntRichEdit6.Tag<>1 then
begin
TntGroupBox14.Tag:=TntRichEdit6.Tag;
TntRichEdit6.Tag:=1;
case TntGroupBox14.Tag of
0:
begin
TntRichEdit6.SelStart:=TntRichEdit5.SelStart*5;
if TntRichEdit5.SelLength=1 then
TntRichEdit6.SelLength:=4
else
TntRichEdit6.SelLength:=9
end;
2:
begin
i:=UTF16CUToCharIndex(Pointer(TntRichEdit5.Text),
TntRichEdit5.SelStart+1,true);
i:=UTF8CharToCUIndex(Pointer(TmpUTF8Str),i,true);
UTF8CUIndexOfChar(Pointer(TmpUTF8Str),i,@j,@charsize);
TntRichEdit6.SelStart:=(i-1)*3;
TntRichEdit6.SelLength:=(charsize-1)*3+2
end;
3:
begin
TntRichEdit6.SelStart:=TntRichEdit5.SelStart*9;
TntRichEdit6.SelLength:=8
end
end
end
end
else
if TntRichEdit5.SelLength>0 then
TntRichEdit5.Tag:=0
end;
procedure TForm1.TntRichEdit6SelectionChange(Sender: TObject);
var
i,j:integer;
begin
if TntRichEdit6.Tag<>1 then
TntGroupBox14.Tag:=TntRichEdit6.Tag;
case TntRichEdit6.Tag of
0:
begin
i:=TntRichEdit6.SelStart div 5 + 1;
TntRichEdit6.Tag:=1;
TntRichEdit6.SelStart:=(i-1)*5;
TntRichEdit6.SelLength:=4;
j:=UTF16CUIndexOfChar(Pointer(TntRichEdit5.Text),i,@j);
TntRichEdit5.Tag:=1;
TntRichEdit5.SelStart:=i-j;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit5.Text),i))=BMPCP then
TntRichEdit5.SelLength:=1
else
TntRichEdit5.SelLength:=2
end;
2:
begin
i:=TntRichEdit6.SelStart div 3 + 1;
TntRichEdit6.Tag:=1;
TntRichEdit6.SelStart:=(i-1)*3;
TntRichEdit6.SelLength:=2;
i:=UTF8CUToCharIndex(Pointer(TmpUTF8Str),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit5.Text),i,true);
TntRichEdit5.Tag:=1;
TntRichEdit5.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit5.Text),i))=BMPCP then
TntRichEdit5.SelLength:=1
else
TntRichEdit5.SelLength:=2
end;
3:
begin
i:=TntRichEdit6.SelStart div 9 + 1;
TntRichEdit6.Tag:=1;
TntRichEdit6.SelStart:=(i-1)*9;
TntRichEdit6.SelLength:=8;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit5.Text),i,true);
TntRichEdit5.Tag:=1;
TntRichEdit5.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit5.Text),i))=BMPCP then
TntRichEdit5.SelLength:=1
else
TntRichEdit5.SelLength:=2
end;
1:
if TntRichEdit6.SelLength>0 then
TntRichEdit6.Tag:=TntGroupBox14.Tag
end;
TntRichEdit5.Tag:=0
end;
procedure TForm1.TntRadioButton17Click(Sender: TObject);
begin
Edit15.SetFocus;
Edit15.Text:='';
Edit15.OnChange(Edit15)
end;
procedure TForm1.TntRadioButton18Click(Sender: TObject);
begin
TntRichEdit6.SetFocus;
TntRichEdit6.OnSelectionChange(TntRichEdit6);
TntButton14.Enabled:=true
end;
procedure TForm1.TntButton14Click(Sender: TObject);
var
i,j:integer;
s1:string;
s:WideString;
b,b1:Byte;
begin
if TntRadioButton17.Checked then
begin
j:=strtoint(Edit15.Text);
i:=UTF16ToUTF8ForChar(Pointer(TntRichEdit1.Text),j,nil);
if i>0 then
begin
SetLength(TmpUTF8Str,i);
if UTF16ToUTF8ForChar(Pointer(TntRichEdit1.Text),j,Pointer(TmpUTF8Str))
=i
then
begin
s1:='<';
for i:=1 to Length(TmpUTF8Str)do
begin
b:=ord(TmpUTF8Str);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
s1:=s1+chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
s1:=s1+chr(b1)+#32
end;
s1:=s1+'>';
s:='字符串中第'+Edit15.Text+'个编码单元所属字符的UTF-16编码单元序列'+
'已经转换为UTF-8编码单元序列'+s1;
MessageBoxW(Form1.Handle,Pointer(s),'试练UTF16ToUTF8ForChar函数',mb_ok)
end
end;
Edit15.SetFocus
end
else
begin
j:=TntRichEdit6.SelStart div 5 + 1;
i:=UTF16ToUTF8ForChar(Pointer(TntRichEdit1.Text),j,nil);
if i>0 then
begin
SetLength(TmpUTF8Str,i);
if UTF16ToUTF8ForChar(Pointer(TntRichEdit1.Text),j,Pointer(TmpUTF8Str))
=i
then
begin
s1:='<';
for i:=1 to Length(TmpUTF8Str)do
begin
b:=ord(TmpUTF8Str);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
s1:=s1+chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
s1:=s1+chr(b1)+#32
end;
s1:=s1+'>';
s:='字符串中第'+inttostr(j)+'个编码单元所属字符的UTF-16编码单元序列'+
'已经转换为UTF-8编码单元序列'+s1;
MessageBoxW(Form1.Handle,Pointer(s),'试练UTF16ToUTF8ForChar函数',mb_ok)
end
end;
TntRichEdit6.SetFocus
end
end;
procedure TForm1.Edit15KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
if TntButton14.Enabled then
TntButton14.Click
end
end;
procedure TForm1.InitGroupBox7_1;
var
pWideChar;
i,j,k:integer;
s:string;
psChar;
CU:WORD;
b:Byte;
begin
p:=Pointer(TntRichEdit5.Text);
SetLength(s,5*Length(TntRichEdit5.Text));
ps:=Pointer(s);
j:=0;
for i:=0 to Length(TntRichEdit5.Text)-1do
begin
CU:=ord(p);
for k:=3do
wnto 0do
begin
b:=CU shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
ps[j]:=chr(b);
inc(j)
end;
ps[j]:=#32;
inc(j)
end;
TntRichEdit6.Tag:=0;
TntRichEdit6.Text:=s
end;
procedure TForm1.InitGroupBox7_2;
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit5.Text),nil);
if i>0 then
begin
SetLength(TmpUTF8Str,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit5.Text),Pointer(TmpUTF8Str))
=i
then
begin
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTF8Str);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit6.Tag:=2;
TntRichEdit6.Text:=s
end
end
end;
procedure TForm1.InitGroupBox7_5;
var
i,j,k:integer;
s:string;
pChar;
b:Byte;
begin
i:=UTF16ToUTF32ForStr(Pointer(TntRichEdit5.Text),nil);
if i>0 then
begin
SetLength(TmpUTF32Str,i);
if UTF16ToUTF32ForStr(Pointer(TntRichEdit5.Text),@TmpUTF32Str[0])=i-1 then
begin
SetLength(s,9*(i-1));
p:=Pointer(s);
j:=0;
for i:=0 to i-2do
begin
for k:=7do
wnto 0do
begin
b:=TmpUTF32Str shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j)
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit6.Tag:=3;
TntRichEdit6.Text:=s
end
end
end;
procedure TForm1.TntRadioButton19Click(Sender: TObject);
var
i:integer;
begin
if Sender is TTntRadioButton then
begin
i:=(Sender as TTntRadioButton).Tag;
GroupBoxArray.Enabled:=true;
GroupBoxArray[EnabGroupBoxIndex].Enabled:=false;
EnabGroupBoxIndex:=i;
case EnabGroupBoxIndex of
0,2,4:
InitGroupBox7_1;
1,3,6:
InitGroupBox7_2;
5,7:
InitGroupBox7_5
end;
TntRichEdit6.SetFocus;
TntRichEdit6.OnSelectionChange(TntRichEdit6)
end
end;
procedure TForm1.TntRadioButton20Click(Sender: TObject);
begin
Edit16.SetFocus;
Edit16.Text:='';
Edit16.OnChange(Edit16)
end;
procedure TForm1.TntRadioButton21Click(Sender: TObject);
begin
TntRichEdit6.SetFocus;
TntRichEdit6.OnSelectionChange(TntRichEdit6);
TntButton15.Enabled:=true
end;
procedure TForm1.Edit16KeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
if TntButton15.Enabled then
TntButton15.Click
end
end;
procedure TForm1.TntButton15Click(Sender: TObject);
var
i,j,k:integer;
s:WideString;
s1:string;
cp:WORD;
b:Byte;
begin
if TntRadioButton20.Checked then
begin
i:=strtoint(Edit16.Text);
j:=UTF8ToUTF16ForChar(Pointer(TmpUTF8Str),i,nil);
if j>0 then
begin
SetLength(s,j);
if UTF8ToUTF16ForChar(Pointer(TmpUTF8Str),i,Pointer(s))=j then
begin
s1:='<';
for j:=1 to jdo
begin
if j>1 then
s1:=s1+#32;
cp:=ord(s[j]);
for k:=3do
wnto 0do
begin
b:=cp shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
s1:=s1+chr(b)
end
end;
s1:=s1+'>';
s:='字符串中第'+Edit16.Text+'个编码单元所属字符的UTF-8编码单元序列'+
'已经转换为UTF-16编码单元序列'+s1;
MessageBoxW(Form1.Handle,Pointer(s),'试练UTF8ToUTF16ForChar函数',mb_ok)
end
end
end
else
begin
i:=TntRichEdit6.SelStart div 3 + 1;
j:=UTF8ToUTF16ForChar(Pointer(TmpUTF8Str),i,nil);
if j>0 then
begin
SetLength(s,j);
if UTF8ToUTF16ForChar(Pointer(TmpUTF8Str),i,Pointer(s))=j then
begin
s1:='<';
for j:=1 to jdo
begin
if j>1 then
s1:=s1+#32;
cp:=ord(s[j]);
for k:=3do
wnto 0do
begin
b:=cp shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
s1:=s1+chr(b)
end
end;
s1:=s1+'>';
s:='字符串中第'+inttostr(i)+'个编码单元所属字符的UTF-8编码单元序列'+
'已经转换为UTF-16编码单元序列'+s1;
MessageBoxW(Form1.Handle,Pointer(s),'试练UTF8ToUTF16ForChar函数',mb_ok)
end
end
end
end;
procedure TForm1.TntButton16Click(Sender: TObject);
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit5.Text),nil);
if i>0 then
begin
SetLength(TmpUTF8Str,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit5.Text),Pointer(TmpUTF8Str))=i then
begin
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTF8Str);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit6.Tag:=2;
TntRichEdit6.Text:=s;
TntRichEdit6.OnSelectionChange(TntRichEdit6);
TntRichEdit6.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-16字符串转换为UTF-8编码格式',
'试练UTF16ToUTF8ForStr函数',mb_ok)
end
end
end;
procedure TForm1.TntButton17Click(Sender: TObject);
var
i,j,k:integer;
s:WideString;
s1:string;
pChar;
cp:WORD;
b:Byte;
begin
i:=UTF8ToUTF16ForStr(Pointer(TmpUTF8Str),nil);
if i>0 then
begin
SetLength(s,i);
if UTF8ToUTF16ForStr(Pointer(TmpUTF8Str),Pointer(s))=i then
begin
SetLength(s1,5*i);
p:=Pointer(s1);
j:=0;
for i:=1 to ido
begin
cp:=ord(s);
for k:=3do
wnto 0do
begin
b:=cp shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j)
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit6.Tag:=0;
TntRichEdit6.Text:=s1;
TntRichEdit6.OnSelectionChange(TntRichEdit6);
TntRichEdit6.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-8字符串转换为UTF-16编码格式',
'试练UTF8ToUTF16ForStr函数',mb_ok)
end
end
end;
procedure TForm1.TntButton18Click(Sender: TObject);
var
i,j,k:integer;
s:string;
pChar;
b:Byte;
begin
i:=UTF16ToUTF32ForStr(Pointer(TntRichEdit5.Text),nil);
if i>0 then
begin
SetLength(TmpUTF32Str,i);
if UTF16ToUTF32ForStr(Pointer(TntRichEdit5.Text),@TmpUTF32Str[0])=i-1 then
begin
SetLength(s,9*(i-1));
p:=Pointer(s);
j:=0;
for i:=0 to i-2do
begin
for k:=7do
wnto 0do
begin
b:=TmpUTF32Str shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j)
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit6.Tag:=3;
TntRichEdit6.Text:=s;
TntRichEdit6.OnSelectionChange(TntRichEdit6);
TntRichEdit6.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-16字符串转换为UTF-32编码格式',
'试练UTF16ToUTF32ForStr函数',mb_ok)
end
end
end;
procedure TForm1.TntButton19Click(Sender: TObject);
var
i,j,k:integer;
s:string;
pChar;
s1:WideString;
cp:WORD;
b:Byte;
begin
i:=UTF32ToUTF16ForStr(@TmpUTF32Str[0],nil);
if i>0 then
begin
SetLength(s1,i);
if UTF32ToUTF16ForStr(@TmpUTF32Str[0],Pointer(s1))=i then
begin
SetLength(s,5*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
cp:=ord(s1);
for k:=3do
wnto 0do
begin
b:=cp shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j)
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit6.Tag:=0;
TntRichEdit6.Text:=s;
TntRichEdit6.OnSelectionChange(TntRichEdit6);
TntRichEdit6.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-32字符串转换为UTF-16编码格式',
'试练UTF32ToUTF16ForStr函数',mb_ok)
end
end
end;
procedure TForm1.TntButton20Click(Sender: TObject);
var
i,j,k:integer;
s:string;
pChar;
b:Byte;
begin
i:=UTF8ToUTF32ForStr(Pointer(TmpUTF8Str),nil);
if i>0 then
begin
SetLength(TmpUTF32Str,i);
if UTF8ToUTF32ForStr(Pointer(TmpUTF8Str),@TmpUTF32Str[0])=i-1 then
begin
SetLength(s,9*(i-1));
p:=Pointer(s);
j:=0;
for i:=0 to i-2do
begin
for k:=7do
wnto 0do
begin
b:=TmpUTF32Str shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j)
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit6.Tag:=3;
TntRichEdit6.Text:=s;
TntRichEdit6.OnSelectionChange(TntRichEdit6);
TntRichEdit6.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-8字符串转换为UTF-32编码格式',
'试练UTF8ToUTF32ForStr函数',mb_ok)
end
end
end;
procedure TForm1.TntButton21Click(Sender: TObject);
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=UTF32ToUTF8ForStr(@TmpUTF32Str[0],nil);
if i>0 then
begin
SetLength(TmpUTF8Str,i);
if UTF32ToUTF8ForStr(@TmpUTF32Str[0],Pointer(TmpUTF8Str))=i then
begin
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTF8Str);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit6.Tag:=2;
TntRichEdit6.Text:=s;
TntRichEdit6.OnSelectionChange(TntRichEdit6);
TntRichEdit6.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-32字符串转换为UTF-8编码格式',
'试练UTF32ToUTF8ForStr函数',mb_ok)
end
end
end;
procedure TForm1.InitGroupBox8_1;
var
pWideChar;
i,j,k:integer;
s:string;
psChar;
CU:WORD;
b:Byte;
begin
p:=Pointer(TntRichEdit7.Text);
SetLength(s,5*Length(TntRichEdit7.Text));
ps:=Pointer(s);
j:=0;
for i:=0 to Length(TntRichEdit7.Text)-1do
begin
CU:=ord(p);
for k:=3do
wnto 0do
begin
b:=CU shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
ps[j]:=chr(b);
inc(j)
end;
ps[j]:=#32;
inc(j)
end;
TntRichEdit8.Tag:=0;
TntRichEdit8.Text:=s
end;
procedure TForm1.InitGroupBox8_2;
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit7.Text),nil);
if i>0 then
begin
SetLength(TmpUTF8Str,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit7.Text),Pointer(TmpUTF8Str))
=i
then
begin
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTF8Str);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit8.Tag:=2;
TntRichEdit8.Text:=s
end
end
end;
procedure TForm1.InitGroupBox8_3;
var
i,j,k:integer;
s:string;
pChar;
b:Byte;
begin
i:=UTF16ToUTF32ForStr(Pointer(TntRichEdit7.Text),nil);
if i>0 then
begin
SetLength(TmpUTF32Str,i);
if UTF16ToUTF32ForStr(Pointer(TntRichEdit7.Text),@TmpUTF32Str[0])=i-1 then
begin
SetLength(s,9*(i-1));
p:=Pointer(s);
j:=0;
for i:=0 to i-2do
begin
for k:=7do
wnto 0do
begin
b:=TmpUTF32Str shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j)
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit8.Tag:=3;
TntRichEdit8.Text:=s
end
end
end;
procedure TForm1.InitGroupBox9_1;
var
pWideChar;
i,j,k:integer;
s:string;
psChar;
CU:WORD;
b:Byte;
begin
p:=Pointer(TntRichEdit9.Text);
SetLength(s,5*Length(TntRichEdit9.Text));
ps:=Pointer(s);
j:=0;
for i:=0 to Length(TntRichEdit9.Text)-1do
begin
CU:=ord(p);
for k:=3do
wnto 0do
begin
b:=CU shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
ps[j]:=chr(b);
inc(j)
end;
ps[j]:=#32;
inc(j)
end;
TntRichEdit10.Tag:=0;
TntRichEdit10.Text:=s
end;
procedure TForm1.InitGroupBox9_2;
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit9.Text),nil);
if i>0 then
begin
SetLength(TmpUTF8Str,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit9.Text),Pointer(TmpUTF8Str))
=i
then
begin
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTF8Str);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit10.Tag:=2;
TntRichEdit10.Text:=s
end
end
end;
procedure TForm1.InitGroupBox9_3;
var
i,j,k:integer;
s:string;
pChar;
b:Byte;
begin
i:=UTF16ToUTF32ForStr(Pointer(TntRichEdit9.Text),nil);
if i>0 then
begin
SetLength(TmpUTF32Str,i);
if UTF16ToUTF32ForStr(Pointer(TntRichEdit9.Text),@TmpUTF32Str[0])=i-1 then
begin
SetLength(s,9*(i-1));
p:=Pointer(s);
j:=0;
for i:=0 to i-2do
begin
for k:=7do
wnto 0do
begin
b:=TmpUTF32Str shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j)
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit10.Tag:=3;
TntRichEdit10.Text:=s
end
end
end;
procedure TForm1.DispBSCommonProc_9(BSType:integer);
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=Length(TmpUTFBS);
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTFBS);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit10.Tag:=BSType;
TntRichEdit10.Text:=s
end;
procedure TForm1.InitGroupBox9_4;
var
i:integer;
begin
i:=UTF16CUSToUTF8BS(Pointer(TntRichEdit9.Text),nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF16CUSToUTF8BS(Pointer(TntRichEdit9.Text),Pointer(TmpUTFBS))
=i
then
DispBSCommonProc_9(4)
end
end;
procedure TForm1.InitGroupBox9_5;
var
i:integer;
begin
i:=CUSToBSForUTF16(Pointer(TntRichEdit9.Text),BOMType_BE,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if CUSToBSForUTF16(Pointer(TntRichEdit9.Text),BOMType_BE,Pointer(
TmpUTFBS))=i
then
DispBSCommonProc_9(5)
end
end;
procedure TForm1.InitGroupBox9_6;
var
i:integer;
begin
i:=UTF16CUSToUTF32BS(Pointer(TntRichEdit9.Text),BOMType_BE,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF16CUSToUTF32BS(Pointer(TntRichEdit9.Text),BOMType_BE,Pointer(
TmpUTFBS))=i
then
DispBSCommonProc_9(6)
end
end;
procedure TForm1.InitGroupBox10_1;
var
pWideChar;
i,j,k:integer;
s:string;
psChar;
CU:WORD;
b:Byte;
begin
p:=Pointer(TntRichEdit11.Text);
SetLength(s,5*Length(TntRichEdit11.Text));
ps:=Pointer(s);
j:=0;
for i:=0 to Length(TntRichEdit11.Text)-1do
begin
CU:=ord(p);
for k:=3do
wnto 0do
begin
b:=CU shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
ps[j]:=chr(b);
inc(j)
end;
ps[j]:=#32;
inc(j)
end;
TntRichEdit12.Tag:=0;
TntRichEdit12.Text:=s
end;
procedure TForm1.InitGroupBox10_2;
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit11.Text),nil);
if i>0 then
begin
SetLength(TmpUTF8Str,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit11.Text),Pointer(TmpUTF8Str))
=i
then
begin
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTF8Str);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit12.Tag:=2;
TntRichEdit12.Text:=s
end
end
end;
procedure TForm1.InitGroupBox10_3;
var
i,j,k:integer;
s:string;
pChar;
b:Byte;
begin
i:=UTF16ToUTF32ForStr(Pointer(TntRichEdit11.Text),nil);
if i>0 then
begin
SetLength(TmpUTF32Str,i);
if UTF16ToUTF32ForStr(Pointer(TntRichEdit11.Text),@TmpUTF32Str[0])=i-1 then
begin
SetLength(s,9*(i-1));
p:=Pointer(s);
j:=0;
for i:=0 to i-2do
begin
for k:=7do
wnto 0do
begin
b:=TmpUTF32Str shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j)
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit12.Tag:=3;
TntRichEdit12.Text:=s
end
end
end;
procedure TForm1.DispBSCommonProc_10(BSType:integer);
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=Length(TmpUTFBS);
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTFBS);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit12.Tag:=BSType;
TntRichEdit12.Text:=s
end;
procedure TForm1.InitGroupBox10_4;
var
i:integer;
begin
i:=UTF16CUSToUTF8BS(Pointer(TntRichEdit11.Text),nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF16CUSToUTF8BS(Pointer(TntRichEdit11.Text),Pointer(TmpUTFBS))
=i
then
DispBSCommonProc_10(4)
end
end;
procedure TForm1.InitGroupBox10_5;
var
i:integer;
begin
i:=CUSToBSForUTF16(Pointer(TntRichEdit11.Text),BOMType_BE,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if CUSToBSForUTF16(Pointer(TntRichEdit11.Text),BOMType_BE,Pointer(
TmpUTFBS))=i
then
DispBSCommonProc_10(5)
end
end;
procedure TForm1.InitGroupBox10_6;
var
i:integer;
begin
i:=UTF16CUSToUTF32BS(Pointer(TntRichEdit11.Text),BOMType_BE,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF16CUSToUTF32BS(Pointer(TntRichEdit11.Text),BOMType_BE,Pointer(
TmpUTFBS))=i
then
DispBSCommonProc_10(6)
end
end;
procedure TForm1.DispBSCommonProc_11(BSType:integer);
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=Length(TmpUTFBS);
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTFBS);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit14.Tag:=BSType;
TntRichEdit14.Text:=s
end;
procedure TForm1.InitGroupBox11_4;
var
i:integer;
begin
i:=UTF16CUSToUTF8BS(Pointer(TntRichEdit13.Text),nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF16CUSToUTF8BS(Pointer(TntRichEdit13.Text),Pointer(TmpUTFBS))
=i
then
DispBSCommonProc_11(4)
end
end;
procedure TForm1.InitGroupBox11_5;
var
i:integer;
begin
i:=CUSToBSForUTF16(Pointer(TntRichEdit13.Text),BOMType_BE,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if CUSToBSForUTF16(Pointer(TntRichEdit13.Text),BOMType_BE,Pointer(
TmpUTFBS))=i
then
DispBSCommonProc_11(5)
end
end;
procedure TForm1.InitGroupBox11_6;
var
i:integer;
begin
i:=UTF16CUSToUTF32BS(Pointer(TntRichEdit13.Text),BOMType_BE,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF16CUSToUTF32BS(Pointer(TntRichEdit13.Text),BOMType_BE,Pointer(
TmpUTFBS))=i
then
DispBSCommonProc_11(6)
end
end;
procedure TForm1.InitGroupBox12_1;
var
pWideChar;
i,j,k:integer;
s:string;
psChar;
CU:WORD;
b:Byte;
begin
p:=Pointer(TntRichEdit15.Text);
SetLength(s,5*Length(TntRichEdit15.Text));
ps:=Pointer(s);
j:=0;
for i:=0 to Length(TntRichEdit15.Text)-1do
begin
CU:=ord(p);
for k:=3do
wnto 0do
begin
b:=CU shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
ps[j]:=chr(b);
inc(j)
end;
ps[j]:=#32;
inc(j)
end;
TntRichEdit16.Tag:=0;
TntRichEdit16.Text:=s
end;
procedure TForm1.InitGroupBox12_2;
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit15.Text),nil);
if i>0 then
begin
SetLength(TmpUTF8Str,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit15.Text),Pointer(TmpUTF8Str))
=i
then
begin
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTF8Str);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit16.Tag:=2;
TntRichEdit16.Text:=s
end
end
end;
procedure TForm1.InitGroupBox12_3;
var
i,j,k:integer;
s:string;
pChar;
b:Byte;
begin
i:=UTF16ToUTF32ForStr(Pointer(TntRichEdit15.Text),nil);
if i>0 then
begin
SetLength(TmpUTF32Str,i);
if UTF16ToUTF32ForStr(Pointer(TntRichEdit15.Text),@TmpUTF32Str[0])=i-1 then
begin
SetLength(s,9*(i-1));
p:=Pointer(s);
j:=0;
for i:=0 to i-2do
begin
for k:=7do
wnto 0do
begin
b:=TmpUTF32Str shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j)
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit16.Tag:=3;
TntRichEdit16.Text:=s
end
end
end;
procedure TForm1.DispBSCommonProc_12(BSType:integer);
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=Length(TmpUTFBS);
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTFBS);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit16.Tag:=BSType;
TntRichEdit16.Text:=s
end;
procedure TForm1.InitGroupBox12_4;
var
i:integer;
begin
i:=UTF16CUSToUTF8BS(Pointer(TntRichEdit15.Text),nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF16CUSToUTF8BS(Pointer(TntRichEdit15.Text),Pointer(TmpUTFBS))
=i
then
DispBSCommonProc_12(4)
end
end;
procedure TForm1.InitGroupBox12_5;
var
i:integer;
begin
i:=CUSToBSForUTF16(Pointer(TntRichEdit15.Text),BOMType_BE,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if CUSToBSForUTF16(Pointer(TntRichEdit15.Text),BOMType_BE,Pointer(
TmpUTFBS))=i
then
DispBSCommonProc_12(5)
end
end;
procedure TForm1.InitGroupBox12_6;
var
i:integer;
begin
i:=UTF16CUSToUTF32BS(Pointer(TntRichEdit15.Text),BOMType_BE,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF16CUSToUTF32BS(Pointer(TntRichEdit15.Text),BOMType_BE,Pointer(
TmpUTFBS))=i
then
DispBSCommonProc_12(6)
end
end;
procedure TForm1.InitGroupBox13_1;
var
pWideChar;
i,j,k:integer;
s:string;
psChar;
CU:WORD;
b:Byte;
begin
p:=Pointer(TntRichEdit17.Text);
SetLength(s,5*Length(TntRichEdit17.Text));
ps:=Pointer(s);
j:=0;
for i:=0 to Length(TntRichEdit17.Text)-1do
begin
CU:=ord(p);
for k:=3do
wnto 0do
begin
b:=CU shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
ps[j]:=chr(b);
inc(j)
end;
ps[j]:=#32;
inc(j)
end;
TntRichEdit18.Tag:=0;
TntRichEdit18.Text:=s
end;
procedure TForm1.InitGroupBox13_2;
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=UTF16ToUTF8ForStr(Pointer(TntRichEdit17.Text),nil);
if i>0 then
begin
SetLength(TmpUTF8Str,i);
if UTF16ToUTF8ForStr(Pointer(TntRichEdit17.Text),Pointer(TmpUTF8Str))
=i
then
begin
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTF8Str);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit18.Tag:=2;
TntRichEdit18.Text:=s
end
end
end;
procedure TForm1.InitGroupBox13_3;
var
i,j,k:integer;
s:string;
pChar;
b:Byte;
begin
i:=UTF16ToUTF32ForStr(Pointer(TntRichEdit17.Text),nil);
if i>0 then
begin
SetLength(TmpUTF32Str,i);
if UTF16ToUTF32ForStr(Pointer(TntRichEdit17.Text),@TmpUTF32Str[0])=i-1 then
begin
SetLength(s,9*(i-1));
p:=Pointer(s);
j:=0;
for i:=0 to i-2do
begin
for k:=7do
wnto 0do
begin
b:=TmpUTF32Str shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j)
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit18.Tag:=3;
TntRichEdit18.Text:=s
end
end
end;
procedure TForm1.DispBSCommonProc_13(BSType:integer);
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=Length(TmpUTFBS);
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTFBS);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit18.Tag:=BSType;
TntRichEdit18.Text:=s
end;
procedure TForm1.InitGroupBox13_4;
var
i:integer;
begin
i:=UTF16CUSToUTF8BS(Pointer(TntRichEdit17.Text),nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF16CUSToUTF8BS(Pointer(TntRichEdit17.Text),Pointer(TmpUTFBS))
=i
then
DispBSCommonProc_13(4)
end
end;
procedure TForm1.InitGroupBox13_5;
var
i:integer;
begin
i:=CUSToBSForUTF16(Pointer(TntRichEdit17.Text),TntComboBox12.Tag,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if CUSToBSForUTF16(Pointer(TntRichEdit17.Text),TntComboBox12.Tag,Pointer(
TmpUTFBS))=i
then
DispBSCommonProc_13(5)
end
end;
procedure TForm1.InitGroupBox13_6;
var
i:integer;
begin
i:=UTF16CUSToUTF32BS(Pointer(TntRichEdit17.Text),TntComboBox14.Tag,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF16CUSToUTF32BS(Pointer(TntRichEdit17.Text),TntComboBox14.Tag,
Pointer(TmpUTFBS))=i
then
DispBSCommonProc_13(6)
end
end;
procedure TForm1.DispBSCommonProc_14(BSType:integer);
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=Length(TmpUTFBS);
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTFBS);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit20.Tag:=BSType;
TntRichEdit20.Text:=s
end;
procedure TForm1.DispBSCommonProc_15(BSType:integer);
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=Length(TmpUTFBS);
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTFBS);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit22.Tag:=BSType;
TntRichEdit22.Text:=s
end;
procedure TForm1.TntRichEdit7Change(Sender: TObject);
begin
case EnabGroupBoxIndex of
0:
InitGroupBox8_1;
1:
InitGroupBox8_2;
2:
InitGroupBox8_3
end
end;
procedure TForm1.TntRichEdit7DblClick(Sender: TObject);
begin
TntRichEdit7.ReadOnly:=not TntRichEdit7.ReadOnly;
if TntRichEdit7.ReadOnly then
begin
TntRichEdit7.Cursor:=crArrow;
TntRichEdit7.OnSelectionChange(TntRichEdit7)
end
else
begin
TntRichEdit7.Cursor:=crDefault;
TntRichEdit7.SelLength:=0
end;
TntRichEdit8.HideSelection:=not TntRichEdit7.ReadOnly;
TntRichEdit7.Tag:=0
end;
procedure TForm1.TntRichEdit7SelectionChange(Sender: TObject);
var
i,j,charsize:integer;
begin
if TntRichEdit7.ReadOnly then
if TntRichEdit7.Tag=0 then
begin
TntRichEdit7.Tag:=1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit7.Text),
TntRichEdit7.SelStart+1))=BMPCP
then
TntRichEdit7.SelLength:=1
else
TntRichEdit7.SelLength:=2;
if TntRichEdit8.Tag<>1 then
begin
TntGroupBox14.Tag:=TntRichEdit8.Tag;
TntRichEdit8.Tag:=1;
case TntGroupBox14.Tag of
0:
begin
TntRichEdit8.SelStart:=TntRichEdit7.SelStart*5;
if TntRichEdit7.SelLength=1 then
TntRichEdit8.SelLength:=4
else
TntRichEdit8.SelLength:=9
end;
2:
begin
i:=UTF16CUToCharIndex(Pointer(TntRichEdit7.Text),
TntRichEdit7.SelStart+1,true);
i:=UTF8CharToCUIndex(Pointer(TmpUTF8Str),i,true);
UTF8CUIndexOfChar(Pointer(TmpUTF8Str),i,@j,@charsize);
TntRichEdit8.SelStart:=(i-1)*3;
TntRichEdit8.SelLength:=(charsize-1)*3+2
end;
3:
begin
TntRichEdit8.SelStart:=TntRichEdit7.SelStart*9;
TntRichEdit8.SelLength:=8
end
end
end
end
else
if TntRichEdit7.SelLength>0 then
TntRichEdit7.Tag:=0
end;
procedure TForm1.TntRichEdit8SelectionChange(Sender: TObject);
var
i,j:integer;
begin
if TntRichEdit8.Tag<>1 then
TntGroupBox14.Tag:=TntRichEdit8.Tag;
case TntRichEdit8.Tag of
0:
begin
i:=TntRichEdit8.SelStart div 5 + 1;
TntRichEdit8.Tag:=1;
TntRichEdit8.SelStart:=(i-1)*5;
TntRichEdit8.SelLength:=4;
j:=UTF16CUIndexOfChar(Pointer(TntRichEdit7.Text),i,@j);
TntRichEdit7.Tag:=1;
TntRichEdit7.SelStart:=i-j;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit7.Text),i))=BMPCP then
TntRichEdit7.SelLength:=1
else
TntRichEdit7.SelLength:=2
end;
2:
begin
i:=TntRichEdit8.SelStart div 3 + 1;
TntRichEdit8.Tag:=1;
TntRichEdit8.SelStart:=(i-1)*3;
TntRichEdit8.SelLength:=2;
i:=UTF8CUToCharIndex(Pointer(TmpUTF8Str),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit7.Text),i,true);
TntRichEdit7.Tag:=1;
TntRichEdit7.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit7.Text),i))=BMPCP then
TntRichEdit7.SelLength:=1
else
TntRichEdit7.SelLength:=2
end;
3:
begin
i:=TntRichEdit8.SelStart div 9 + 1;
TntRichEdit8.Tag:=1;
TntRichEdit8.SelStart:=(i-1)*9;
TntRichEdit8.SelLength:=8;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit7.Text),i,true);
TntRichEdit7.Tag:=1;
TntRichEdit7.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit7.Text),i))=BMPCP then
TntRichEdit7.SelLength:=1
else
TntRichEdit7.SelLength:=2
end;
1:
if TntRichEdit8.SelLength>0 then
TntRichEdit8.Tag:=TntGroupBox14.Tag
end;
TntRichEdit7.Tag:=0
end;
procedure TForm1.TntRadioButton29Click(Sender: TObject);
var
i:integer;
begin
if Sender is TTntRadioButton then
begin
i:=(Sender as TTntRadioButton).Tag;
GroupBoxArray.Enabled:=true;
GroupBoxArray[EnabGroupBoxIndex].Enabled:=false;
EnabGroupBoxIndex:=i;
case EnabGroupBoxIndex of
0:
InitGroupBox8_1;
1:
InitGroupBox8_2;
2:
InitGroupBox8_3
end;
TntRichEdit8.SetFocus;
TntRichEdit8.OnSelectionChange(TntRichEdit8)
end
end;
procedure TForm1.TntButton22Click(Sender: TObject);
var
s:WideString;
begin
s:='UTF-16字符串里面共有'+inttostr(CharCountOfUTF16Str(Pointer(
TntRichEdit7.Text)))+'个字符';
MessageBoxW(Form1.Handle,Pointer(s),'试练CharCountOfUTF16Str函数',mb_ok)
end;
procedure TForm1.TntButton23Click(Sender: TObject);
var
s:WideString;
begin
s:='UTF-8字符串里面共有'+inttostr(CharCountOfUTF8Str(Pointer(TmpUTF8Str)))+
'个字符';
MessageBoxW(Form1.Handle,Pointer(s),'试练CharCountOfUTF16Str函数',mb_ok)
end;
procedure TForm1.TntButton24Click(Sender: TObject);
var
s:WideString;
begin
s:='UTF-32字符串里面共有'+inttostr(CharCountOfUTF32Str(@TmpUTF32Str[0]))+
'个字符';
MessageBoxW(Form1.Handle,Pointer(s),'试练CharCountOfUTF16Str函数',mb_ok)
end;
procedure TForm1.TntTabSheet9Show(Sender: TObject);
var
i,c,c1:integer;
begin
TntRichEdit9.Text:=TntRichEdit1.Text;
TntRichEdit9.OnSelectionChange(TntRichEdit9);
TntRichEdit9.SetFocus;
TntRichEdit9.Tag:=0;
SetLength(RadioBtnArray,0);
SetLength(GroupBoxArray,0);
c:=0;
c1:=0;
for i:=0 to TntTabSheet9.ControlCount-1do
if TntTabSheet9.Controls is TTntRadioButton then
begin
inc(c);
SetLength(RadioBtnArray,c);
RadioBtnArray[c-1]:=TntTabSheet9.Controls as TTntRadioButton;
RadioBtnArray[c-1].Tag:=c-1;
GroupBoxArray[c-1].Enabled:=RadioBtnArray[c-1].Checked;
if GroupBoxArray[c-1].Enabled then
EnabGroupBoxIndex:=c-1
end
else
if TntTabSheet9.Controls is TTntGroupBox then
begin
inc(c1);
SetLength(GroupBoxArray,c1);
GroupBoxArray[c1-1]:=TntTabSheet9.Controls as TTntGroupBox
end
end;
procedure TForm1.TntTabSheet5Show(Sender: TObject);
begin
TntRichEdit1.Text:=WideString('这是由Delphi大富翁韦剑共享出来的Unicode编码'+
'处理例程库演示程序。你现在看到的这段演示文本里面包含有两个属于Unicode第2增'+
'补平面的CJK ExtB汉字,它们是U+20000的【')+WideChar($D840)+WideChar($DC00)+
WideString('】和U+20001的【')+WideChar($D840)+WideChar($DC01)+
WideString('】。如果你的系统上无法看到这两个汉字,可以安装海峰五笔的超大'+
'字集支持包(http://okuc.net/software/UniFonts.exe)来解决。');
TntRichEdit1.OnSelectionChange(TntRichEdit1);
TntRichEdit1.SetFocus;
TntRichEdit1.Tag:=0
end;
procedure TForm1.TntTabSheet6Show(Sender: TObject);
begin
TntRichEdit2.Text:=TntRichEdit1.Text;
TntRichEdit2.OnSelectionChange(TntRichEdit2);
TntRichEdit2.SetFocus;
TntRichEdit2.Tag:=0
end;
procedure TForm1.TntTabSheet7Show(Sender: TObject);
var
i,c,c1:integer;
begin
TntRichEdit5.Text:=TntRichEdit1.Text;
TntRichEdit5.OnSelectionChange(TntRichEdit5);
TntRichEdit5.SetFocus;
TntRichEdit5.Tag:=0;
SetLength(RadioBtnArray,0);
SetLength(GroupBoxArray,0);
c:=0;
c1:=0;
for i:=0 to TntTabSheet7.ControlCount-1do
if TntTabSheet7.Controls is TTntRadioButton then
begin
inc(c);
SetLength(RadioBtnArray,c);
RadioBtnArray[c-1]:=TntTabSheet7.Controls as TTntRadioButton;
RadioBtnArray[c-1].Tag:=c-1;
GroupBoxArray[c-1].Enabled:=RadioBtnArray[c-1].Checked;
if GroupBoxArray[c-1].Enabled then
EnabGroupBoxIndex:=c-1
end
else
if TntTabSheet7.Controls is TTntGroupBox then
begin
inc(c1);
SetLength(GroupBoxArray,c1);
GroupBoxArray[c1-1]:=TntTabSheet7.Controls as TTntGroupBox
end
end;
procedure TForm1.TntTabSheet8Show(Sender: TObject);
var
i,c,c1:integer;
begin
TntRichEdit7.Text:=TntRichEdit1.Text;
TntRichEdit7.OnSelectionChange(TntRichEdit7);
TntRichEdit7.SetFocus;
TntRichEdit7.Tag:=0;
SetLength(RadioBtnArray,0);
SetLength(GroupBoxArray,0);
c:=0;
c1:=0;
for i:=0 to TntTabSheet8.ControlCount-1do
if TntTabSheet8.Controls is TTntRadioButton then
begin
inc(c);
SetLength(RadioBtnArray,c);
RadioBtnArray[c-1]:=TntTabSheet8.Controls as TTntRadioButton;
RadioBtnArray[c-1].Tag:=c-1;
GroupBoxArray[c-1].Enabled:=RadioBtnArray[c-1].Checked;
if GroupBoxArray[c-1].Enabled then
EnabGroupBoxIndex:=c-1
end
else
if TntTabSheet8.Controls is TTntGroupBox then
begin
inc(c1);
SetLength(GroupBoxArray,c1);
GroupBoxArray[c1-1]:=TntTabSheet8.Controls as TTntGroupBox
end
end;
procedure TForm1.TntTabSheet1Show(Sender: TObject);
var
i:integer;
TntTabSheet:TTntTabSheet;
begin
if Sender is TTntTabSheet then
begin
TntTabSheet:=Sender as TTntTabSheet;
for i:=TntTabSheet.ControlCount-1do
wnto 0do
if TntTabSheet.Controls is TTntPageControl then
(TntTabSheet.Controls as TTntPageControl).ActivePage.OnShow(
(TntTabSheet.Controls as TTntPageControl).ActivePage)
end
end;
procedure TForm1.TntRichEdit9Change(Sender: TObject);
begin
case EnabGroupBoxIndex of
0:
InitGroupBox9_2;
1:
InitGroupBox9_4;
2:
InitGroupBox9_1;
3:
InitGroupBox9_5;
4:
InitGroupBox9_3;
5:
InitGroupBox9_6
end
end;
procedure TForm1.TntRichEdit9DblClick(Sender: TObject);
begin
TntRichEdit9.ReadOnly:=not TntRichEdit9.ReadOnly;
if TntRichEdit9.ReadOnly then
begin
TntRichEdit9.Cursor:=crArrow;
TntRichEdit9.OnSelectionChange(TntRichEdit9)
end
else
begin
TntRichEdit9.Cursor:=crDefault;
TntRichEdit9.SelLength:=0
end;
TntRichEdit10.HideSelection:=not TntRichEdit9.ReadOnly;
TntRichEdit9.Tag:=0
end;
procedure TForm1.TntRichEdit9SelectionChange(Sender: TObject);
label 10;
var
i,j,charsize:integer;
begin
if TntRichEdit9.ReadOnly then
if TntRichEdit9.Tag=0 then
begin
TntRichEdit9.Tag:=1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit9.Text),
TntRichEdit9.SelStart+1))=BMPCP
then
TntRichEdit9.SelLength:=1
else
TntRichEdit9.SelLength:=2;
if TntRichEdit10.Tag<>1 then
begin
TntGroupBox14.Tag:=TntRichEdit10.Tag;
TntRichEdit10.Tag:=1;
case TntGroupBox14.Tag of
0:
begin
TntRichEdit10.SelStart:=TntRichEdit9.SelStart*5;
if TntRichEdit9.SelLength=1 then
TntRichEdit10.SelLength:=4
else
TntRichEdit10.SelLength:=9
end;
2:
begin
TntButton25.Tag:=0;
10:
i:=UTF16CUToCharIndex(Pointer(TntRichEdit9.Text),
TntRichEdit9.SelStart+1,true);
i:=UTF8CharToCUIndex(Pointer(TmpUTF8Str),i,true);
UTF8CUIndexOfChar(Pointer(TmpUTF8Str),i,@j,@charsize);
i:=i+BOMSizeOfUTF8*TntButton25.Tag;
TntRichEdit10.SelStart:=(i-1)*3;
TntRichEdit10.SelLength:=(charsize-1)*3+2
end;
3:
begin
i:=TntRichEdit9.SelStart+1;
i:=UTF16CUToCharIndex(Pointer(TntRichEdit9.Text),i,true);
TntRichEdit10.SelStart:=(i-1)*9;
TntRichEdit10.SelLength:=8
end;
4:
begin
TntButton25.Tag:=BOMTypeOfUTF8BS(Pointer(TmpUTFBS));
goto 10
end;
5:
begin
TntButton27.Tag:=BOMTypeOfUTF16BS(Pointer(TmpUTFBS),Length(
TmpUTFBS));
if TntButton27.Tag>0 then
i:=TntRichEdit9.SelStart+1
else
i:=TntRichEdit9.SelStart;
TntRichEdit10.SelStart:=i*2*3;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit9.Text),
TntRichEdit9.SelStart+1))=BMPCP
then
TntRichEdit10.SelLength:=5
else
TntRichEdit10.SelLength:=11
end;
6:
begin
TntButton29.Tag:=BOMTypeOfUTF32BS(Pointer(TmpUTFBS),Length(
TmpUTFBS));
i:=UTF16CUToCharIndex(Pointer(TntRichEdit9.Text),
TntRichEdit9.SelStart+1,true)-1;
if TntButton29.Tag>0 then
inc(i);
TntRichEdit10.SelStart:=i*4*3;
TntRichEdit10.SelLength:=11
end
end
end
end
else
if TntRichEdit9.SelLength>0 then
TntRichEdit9.Tag:=0
end;
procedure TForm1.TntRichEdit10SelectionChange(Sender: TObject);
label 10;
var
i,j:integer;
begin
if TntRichEdit10.Tag<>1 then
TntGroupBox14.Tag:=TntRichEdit10.Tag;
case TntRichEdit10.Tag of
0:
begin
i:=TntRichEdit10.SelStart div 5 + 1;
TntRichEdit10.Tag:=1;
TntRichEdit10.SelStart:=(i-1)*5;
TntRichEdit10.SelLength:=4;
j:=UTF16CUIndexOfChar(Pointer(TntRichEdit9.Text),i,@j);
TntRichEdit9.Tag:=1;
TntRichEdit9.SelStart:=i-j;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit9.Text),i))=BMPCP then
TntRichEdit9.SelLength:=1
else
TntRichEdit9.SelLength:=2
end;
2:
begin
TntButton25.Tag:=0;
10:
i:=TntRichEdit10.SelStart div 3 + 1;
TntRichEdit10.Tag:=1;
TntRichEdit10.SelStart:=(i-1)*3;
TntRichEdit10.SelLength:=2;
if (TntButton25.Tag=1) and (i<=BOMSizeOfUTF8) then
begin
TntRichEdit9.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-8编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit9.HideSelection:=false;
i:=i-BOMSizeOfUTF8*TntButton25.Tag;
if not TntRichEdit9.HideSelection then
begin
i:=UTF8CUToCharIndex(Pointer(TmpUTF8Str),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit9.Text),i,true);
TntRichEdit9.Tag:=1;
TntRichEdit9.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit9.Text),i))=BMPCP then
TntRichEdit9.SelLength:=1
else
TntRichEdit9.SelLength:=2
end
end;
3:
begin
i:=TntRichEdit10.SelStart div 9 + 1;
TntRichEdit10.Tag:=1;
TntRichEdit10.SelStart:=(i-1)*9;
TntRichEdit10.SelLength:=8;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit9.Text),i,true);
TntRichEdit9.Tag:=1;
TntRichEdit9.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit9.Text),i))=BMPCP then
TntRichEdit9.SelLength:=1
else
TntRichEdit9.SelLength:=2
end;
4:
begin
TntButton25.Tag:=BOMTypeOfUTF8BS(Pointer(TmpUTFBS));
goto 10
end;
5:
begin
TntButton27.Tag:=BOMTypeOfUTF16BS(Pointer(TmpUTFBS),Length(TmpUTFBS));
i:=TntRichEdit10.SelStart div 3 + 1;
TntRichEdit10.Tag:=1;
TntRichEdit10.SelStart:=(i-1)*3;
TntRichEdit10.SelLength:=2;
if TntButton27.Tag>0 then
begin
if i<=BOMSizeOfUTF16 then
begin
TntRichEdit9.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-16编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit9.HideSelection:=false;
i:=i-BOMSizeOfUTF16
end
else
TntRichEdit9.HideSelection:=false;
if not TntRichEdit9.HideSelection then
begin
i:=(i-1) div 2 + 1;
i:=UTF16CUToCharIndex(Pointer(TntRichEdit9.Text),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit9.Text),i,true);
TntRichEdit9.Tag:=1;
TntRichEdit9.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit9.Text),i))=BMPCP then
TntRichEdit9.SelLength:=1
else
TntRichEdit9.SelLength:=2
end
end;
6:
begin
TntButton29.Tag:=BOMTypeOfUTF32BS(Pointer(TmpUTFBS),Length(TmpUTFBS));
i:=TntRichEdit10.SelStart div 3 + 1;
TntRichEdit10.Tag:=1;
TntRichEdit10.SelStart:=(i-1)*3;
TntRichEdit10.SelLength:=2;
if TntButton29.Tag>0 then
begin
if i<=BOMSizeOfUTF32 then
begin
TntRichEdit9.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-32编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit9.HideSelection:=false;
i:=i-BOMSizeOfUTF32
end
else
TntRichEdit9.HideSelection:=false;
if not TntRichEdit9.HideSelection then
begin
i:=(i-1) div 4 + 1;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit9.Text),i,true);
TntRichEdit9.Tag:=1;
TntRichEdit9.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit9.Text),i))=BMPCP then
TntRichEdit9.SelLength:=1
else
TntRichEdit9.SelLength:=2
end
end;
1:
if TntRichEdit10.SelLength>0 then
TntRichEdit10.Tag:=TntGroupBox14.Tag
end;
TntRichEdit9.Tag:=0
end;
procedure TForm1.TntButton25Click(Sender: TObject);
label 10;
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
if TntComboBox1.ItemIndex=0 then
begin
TmpUTFBS:=TmpUTF8Str;
i:=Length(TmpUTFBS);
goto 10
end
else
begin
i:=CUSToBSForUTF8(Pointer(TmpUTF8Str),nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if CUSToBSForUTF8(Pointer(TmpUTF8Str),Pointer(TmpUTFBS))=i then
begin
10:
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTFBS);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit10.Tag:=4;
TntRichEdit10.Text:=s;
TntRichEdit10.OnSelectionChange(TntRichEdit10);
TntRichEdit10.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-8编码单元序列转换为带或不带'+
'BOM的UTF-8编码格式字节序列','试练CUSToBSForUTF8函数',mb_ok)
end
end
end
end;
procedure TForm1.TntRadioButton32Click(Sender: TObject);
var
i:integer;
begin
if Sender is TTntRadioButton then
begin
i:=(Sender as TTntRadioButton).Tag;
GroupBoxArray.Enabled:=true;
GroupBoxArray[EnabGroupBoxIndex].Enabled:=false;
EnabGroupBoxIndex:=i;
case EnabGroupBoxIndex of
0:
InitGroupBox9_2;
1:
InitGroupBox9_4;
2:
InitGroupBox9_1;
3:
InitGroupBox9_5;
4:
InitGroupBox9_3;
5:
InitGroupBox9_6
end;
TntRichEdit9.SetFocus;
TntRichEdit9.OnSelectionChange(TntRichEdit9)
end
end;
procedure TForm1.TntButton26Click(Sender: TObject);
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=BSToCUSForUTF8(Pointer(TmpUTFBS),nil);
if i>0 then
begin
SetLength(TmpUTF8Str,i);
if BSToCUSForUTF8(Pointer(TmpUTFBS),Pointer(TmpUTF8Str))=i then
begin
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTF8Str);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit10.Tag:=2;
TntRichEdit10.Text:=s;
TntRichEdit10.OnSelectionChange(TntRichEdit10);
TntRichEdit10.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-8编码格式字节序列转换为UTF-8'+
'编码单元序列','试练BSToCUSForUTF8函数',mb_ok)
end
end
end;
procedure TForm1.TntButton27Click(Sender: TObject);
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=CUSToBSForUTF16(Pointer(TntRichEdit9.Text),TntComboBox2.ItemIndex,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if CUSToBSForUTF16(Pointer(TntRichEdit9.Text),TntComboBox2.ItemIndex,
Pointer(TmpUTFBS))=i
then
begin
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTFBS);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit10.Tag:=5;
TntRichEdit10.Text:=s;
TntRichEdit10.OnSelectionChange(TntRichEdit10);
TntRichEdit10.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-16编码单元序列转换为带或不带'+
'BOM的UTF-16编码格式字节序列','试练CUSToBSForUTF16函数',mb_ok)
end
end
end;
procedure TForm1.TntButton28Click(Sender: TObject);
var
i,j,k:integer;
s:WideString;
s1:string;
pChar;
cp:WORD;
b:Byte;
begin
i:=BSToCUSForUTF16(Pointer(TmpUTFBS),Length(TmpUTFBS),nil);
if i>0 then
begin
SetLength(s,i);
if BSToCUSForUTF16(Pointer(TmpUTFBS),Length(TmpUTFBS),Pointer(s))=i then
begin
SetLength(s1,5*i);
p:=Pointer(s1);
j:=0;
for i:=1 to ido
begin
cp:=ord(s);
for k:=3do
wnto 0do
begin
b:=cp shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j);
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit10.Tag:=0;
TntRichEdit10.Text:=s1;
TntRichEdit10.OnSelectionChange(TntRichEdit10);
TntRichEdit10.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把带或不带BOM的UTF-16编码格式字节序列'+
'转换为UTF-16编码单元序列','试练BSToCUSForUTF16函数',mb_ok)
end
end
end;
procedure TForm1.TntButton29Click(Sender: TObject);
var
i:integer;
begin
i:=CUSToBSForUTF32(@TmpUTF32Str[0],TntComboBox3.ItemIndex,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if CUSToBSForUTF32(@TmpUTF32Str[0],TntComboBox3.ItemIndex,Pointer(
TmpUTFBS))=i
then
begin
DispBSCommonProc_9(6);
TntRichEdit10.OnSelectionChange(TntRichEdit10);
TntRichEdit10.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-32编码单元序列转换为带或不带'+
'BOM的UTF-32编码格式字节序列','试练CUSToBSForUTF32函数',mb_ok)
end
end
end;
procedure TForm1.TntButton30Click(Sender: TObject);
var
i,j,k:integer;
s:string;
pChar;
b:Byte;
begin
i:=BSToCUSForUTF32(Pointer(TmpUTFBS),Length(TmpUTFBS),nil);
if i>0 then
begin
SetLength(TmpUTF32Str,i);
if BSToCUSForUTF32(Pointer(TmpUTFBS),Length(TmpUTFBS),@TmpUTF32Str[0])=
i-1
then
begin
SetLength(s,9*(i-1));
p:=Pointer(s);
j:=0;
for i:=0 to i-2do
begin
for k:=7do
wnto 0do
begin
b:=TmpUTF32Str shr (k*4) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j);
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit10.Tag:=3;
TntRichEdit10.Text:=s;
TntRichEdit10.OnSelectionChange(TntRichEdit10);
TntRichEdit10.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把带或不带BOM的UTF-32编码格式字节序列'+
'转换为UTF-32编码单元序列','试练BSToCUSForUTF32函数',mb_ok)
end
end
end;
procedure TForm1.TntTabSheet10Show(Sender: TObject);
var
i,c,c1:integer;
begin
TntRichEdit11.Text:=TntRichEdit1.Text;
TntRichEdit11.OnSelectionChange(TntRichEdit11);
TntRichEdit11.SetFocus;
TntRichEdit11.Tag:=0;
SetLength(RadioBtnArray,0);
SetLength(GroupBoxArray,0);
c:=0;
c1:=0;
for i:=0 to TntTabSheet10.ControlCount-1do
if TntTabSheet10.Controls is TTntRadioButton then
begin
inc(c);
SetLength(RadioBtnArray,c);
RadioBtnArray[c-1]:=TntTabSheet10.Controls as TTntRadioButton;
RadioBtnArray[c-1].Tag:=c-1;
GroupBoxArray[c-1].Enabled:=RadioBtnArray[c-1].Checked;
if GroupBoxArray[c-1].Enabled then
EnabGroupBoxIndex:=c-1
end
else
if TntTabSheet10.Controls is TTntGroupBox then
begin
inc(c1);
SetLength(GroupBoxArray,c1);
GroupBoxArray[c1-1]:=TntTabSheet10.Controls as TTntGroupBox
end
end;
procedure TForm1.TntRichEdit11Change(Sender: TObject);
begin
case EnabGroupBoxIndex of
0,1:
InitGroupBox10_4;
2,3:
InitGroupBox10_5;
4,5:
InitGroupBox10_6
end
end;
procedure TForm1.TntRadioButton38Click(Sender: TObject);
var
i:integer;
begin
if Sender is TTntRadioButton then
begin
i:=(Sender as TTntRadioButton).Tag;
GroupBoxArray.Enabled:=true;
GroupBoxArray[EnabGroupBoxIndex].Enabled:=false;
EnabGroupBoxIndex:=i;
case EnabGroupBoxIndex of
0,1:
InitGroupBox10_4;
2,3:
InitGroupBox10_5;
4,5:
InitGroupBox10_6
end;
TntRichEdit11.SetFocus;
TntRichEdit11.OnSelectionChange(TntRichEdit11)
end
end;
procedure TForm1.TntRichEdit11DblClick(Sender: TObject);
begin
TntRichEdit11.ReadOnly:=not TntRichEdit11.ReadOnly;
if TntRichEdit11.ReadOnly then
begin
TntRichEdit11.Cursor:=crArrow;
TntRichEdit11.OnSelectionChange(TntRichEdit11)
end
else
begin
TntRichEdit11.Cursor:=crDefault;
TntRichEdit11.SelLength:=0
end;
TntRichEdit12.HideSelection:=not TntRichEdit11.ReadOnly;
TntRichEdit11.Tag:=0
end;
procedure TForm1.TntRichEdit11SelectionChange(Sender: TObject);
label 10;
var
i,j,charsize:integer;
begin
if TntRichEdit11.ReadOnly then
if TntRichEdit11.Tag=0 then
begin
TntRichEdit11.Tag:=1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit11.Text),
TntRichEdit11.SelStart+1))=BMPCP
then
TntRichEdit11.SelLength:=1
else
TntRichEdit11.SelLength:=2;
if TntRichEdit12.Tag<>1 then
begin
TntGroupBox14.Tag:=TntRichEdit12.Tag;
TntRichEdit12.Tag:=1;
case TntGroupBox14.Tag of
0:
begin
TntRichEdit12.SelStart:=TntRichEdit11.SelStart*5;
if TntRichEdit11.SelLength=1 then
TntRichEdit12.SelLength:=4
else
TntRichEdit12.SelLength:=9
end;
2:
begin
TntButton25.Tag:=0;
10:
i:=UTF16CUToCharIndex(Pointer(TntRichEdit11.Text),
TntRichEdit11.SelStart+1,true);
i:=UTF8CharToCUIndex(Pointer(TmpUTF8Str),i,true);
UTF8CUIndexOfChar(Pointer(TmpUTF8Str),i,@j,@charsize);
i:=i+BOMSizeOfUTF8*TntButton25.Tag;
TntRichEdit12.SelStart:=(i-1)*3;
TntRichEdit12.SelLength:=(charsize-1)*3+2
end;
3:
begin
i:=TntRichEdit11.SelStart+1;
i:=UTF16CUToCharIndex(Pointer(TntRichEdit11.Text),i,true);
TntRichEdit12.SelStart:=(i-1)*9;
TntRichEdit12.SelLength:=8
end;
4:
begin
TntButton25.Tag:=BOMTypeOfUTF8BS(Pointer(TmpUTFBS));
goto 10
end;
5:
begin
TntButton27.Tag:=BOMTypeOfUTF16BS(Pointer(TmpUTFBS),Length(
TmpUTFBS));
if TntButton27.Tag>0 then
i:=TntRichEdit11.SelStart+1
else
i:=TntRichEdit11.SelStart;
TntRichEdit12.SelStart:=i*2*3;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit11.Text),
TntRichEdit11.SelStart+1))=BMPCP
then
TntRichEdit12.SelLength:=5
else
TntRichEdit12.SelLength:=11
end;
6:
begin
TntButton29.Tag:=BOMTypeOfUTF32BS(Pointer(TmpUTFBS),Length(
TmpUTFBS));
i:=UTF16CUToCharIndex(Pointer(TntRichEdit11.Text),
TntRichEdit11.SelStart+1,true)-1;
if TntButton29.Tag>0 then
inc(i);
TntRichEdit12.SelStart:=i*4*3;
TntRichEdit12.SelLength:=11
end
end
end
end
else
if TntRichEdit11.SelLength>0 then
TntRichEdit11.Tag:=0
end;
procedure TForm1.TntRichEdit12SelectionChange(Sender: TObject);
label 10;
var
i,j:integer;
begin
if TntRichEdit12.Tag<>1 then
TntGroupBox14.Tag:=TntRichEdit12.Tag;
case TntRichEdit12.Tag of
0:
begin
i:=TntRichEdit12.SelStart div 5 + 1;
TntRichEdit12.Tag:=1;
TntRichEdit12.SelStart:=(i-1)*5;
TntRichEdit12.SelLength:=4;
j:=UTF16CUIndexOfChar(Pointer(TntRichEdit11.Text),i,@j);
TntRichEdit11.Tag:=1;
TntRichEdit11.SelStart:=i-j;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit11.Text),i))=BMPCP then
TntRichEdit11.SelLength:=1
else
TntRichEdit11.SelLength:=2
end;
2:
begin
TntButton25.Tag:=0;
10:
i:=TntRichEdit12.SelStart div 3 + 1;
TntRichEdit12.Tag:=1;
TntRichEdit12.SelStart:=(i-1)*3;
TntRichEdit12.SelLength:=2;
if (TntButton25.Tag=1) and (i<=BOMSizeOfUTF8) then
begin
TntRichEdit11.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-8编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit11.HideSelection:=false;
i:=i-BOMSizeOfUTF8*TntButton25.Tag;
if not TntRichEdit11.HideSelection then
begin
i:=UTF8CUToCharIndex(Pointer(TmpUTF8Str),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit11.Text),i,true);
TntRichEdit11.Tag:=1;
TntRichEdit11.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit11.Text),i))=BMPCP then
TntRichEdit11.SelLength:=1
else
TntRichEdit11.SelLength:=2
end
end;
3:
begin
i:=TntRichEdit12.SelStart div 9 + 1;
TntRichEdit12.Tag:=1;
TntRichEdit12.SelStart:=(i-1)*9;
TntRichEdit12.SelLength:=8;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit11.Text),i,true);
TntRichEdit11.Tag:=1;
TntRichEdit11.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit11.Text),i))=BMPCP then
TntRichEdit11.SelLength:=1
else
TntRichEdit11.SelLength:=2
end;
4:
begin
TntButton25.Tag:=BOMTypeOfUTF8BS(Pointer(TmpUTFBS));
goto 10
end;
5:
begin
TntButton27.Tag:=BOMTypeOfUTF16BS(Pointer(TmpUTFBS),Length(TmpUTFBS));
i:=TntRichEdit12.SelStart div 3 + 1;
TntRichEdit12.Tag:=1;
TntRichEdit12.SelStart:=(i-1)*3;
TntRichEdit12.SelLength:=2;
if TntButton27.Tag>0 then
begin
if i<=BOMSizeOfUTF16 then
begin
TntRichEdit11.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-16编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit11.HideSelection:=false;
i:=i-BOMSizeOfUTF16
end
else
TntRichEdit11.HideSelection:=false;
if not TntRichEdit11.HideSelection then
begin
i:=(i-1) div 2 + 1;
i:=UTF16CUToCharIndex(Pointer(TntRichEdit11.Text),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit11.Text),i,true);
TntRichEdit11.Tag:=1;
TntRichEdit11.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit11.Text),i))=BMPCP then
TntRichEdit11.SelLength:=1
else
TntRichEdit11.SelLength:=2
end
end;
6:
begin
TntButton29.Tag:=BOMTypeOfUTF32BS(Pointer(TmpUTFBS),Length(TmpUTFBS));
i:=TntRichEdit12.SelStart div 3 + 1;
TntRichEdit12.Tag:=1;
TntRichEdit12.SelStart:=(i-1)*3;
TntRichEdit12.SelLength:=2;
if TntButton29.Tag>0 then
begin
if i<=BOMSizeOfUTF32 then
begin
TntRichEdit11.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-32编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit11.HideSelection:=false;
i:=i-BOMSizeOfUTF32
end
else
TntRichEdit11.HideSelection:=false;
if not TntRichEdit11.HideSelection then
begin
i:=(i-1) div 4 + 1;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit11.Text),i,true);
TntRichEdit11.Tag:=1;
TntRichEdit11.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit11.Text),i))=BMPCP then
TntRichEdit11.SelLength:=1
else
TntRichEdit11.SelLength:=2
end
end;
1:
if TntRichEdit12.SelLength>0 then
TntRichEdit12.Tag:=TntGroupBox14.Tag
end;
TntRichEdit11.Tag:=0
end;
procedure TForm1.TntButton31Click(Sender: TObject);
var
i:integer;
s:string;
begin
i:=Length(TmpUTFBS);
if not (TBSType(GuessBSType(Pointer(TmpUTFBS),@i,80))
in [BS_UTF8WithBOM,BS_UTF8WithoutBOM])
then
InitGroupBox10_4;
i:=UTF8ToUTF16ForBS(Pointer(TmpUTFBS),TntComboBox4.ItemIndex,nil);
if i>0 then
begin
SetLength(s,i);
if UTF8ToUTF16ForBS(Pointer(TmpUTFBS),TntComboBox4.ItemIndex,
Pointer(s))=i
then
begin
TmpUTFBS:=s;
DispBSCommonProc_10(5)
end;
TntRichEdit12.OnSelectionChange(TntRichEdit12);
TntRichEdit12.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-8编码格式字节序列转换为带或不带'+
'BOM的UTF-16编码格式字节序列','试练UTF8ToUTF16ForBS函数',mb_ok)
end
end;
procedure TForm1.TntButton32Click(Sender: TObject);
var
i:integer;
s:string;
begin
i:=Length(TmpUTFBS);
if not (TBSType(GuessBSType(Pointer(TmpUTFBS),@i,80))
in [BS_UTF8WithBOM,BS_UTF8WithoutBOM])
then
InitGroupBox10_4;
i:=UTF8ToUTF32ForBS(Pointer(TmpUTFBS),TntComboBox5.ItemIndex,nil);
if i>0 then
begin
SetLength(s,i);
if UTF8ToUTF32ForBS(Pointer(TmpUTFBS),TntComboBox5.ItemIndex,
Pointer(s))=i
then
begin
TmpUTFBS:=s;
DispBSCommonProc_10(6)
end;
TntRichEdit12.OnSelectionChange(TntRichEdit12);
TntRichEdit12.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-8编码格式字节序列转换为带或不带'+
'BOM的UTF-32编码格式字节序列','试练UTF8ToUTF32ForBS函数',mb_ok)
end
end;
procedure TForm1.TntButton33Click(Sender: TObject);
var
i:integer;
s:string;
begin
i:=UTF16ToUTF8ForBS(Pointer(TmpUTFBS),Length(TmpUTFBS),nil);
if i>0 then
begin
SetLength(s,i);
if UTF16ToUTF8ForBS(Pointer(TmpUTFBS),Length(TmpUTFBS),Pointer(s))=i then
begin
TmpUTFBS:=s;
DispBSCommonProc_10(4)
end;
TntRichEdit12.OnSelectionChange(TntRichEdit12);
TntRichEdit12.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-16编码格式字节序列转换为带BOM的'+
'UTF-8编码格式字节序列','试练UTF16ToUTF8ForBS函数',mb_ok)
end
end;
procedure TForm1.TntButton34Click(Sender: TObject);
var
i:integer;
s:string;
begin
i:=Length(TmpUTFBS);
if not (TBSType(GuessBSType(Pointer(TmpUTFBS),@i,80))
in [BS_UTF16Default..BS_UTF16LE])
then
InitGroupBox10_5;
i:=UTF16ToUTF32ForBS(Pointer(TmpUTFBS),Length(TmpUTFBS),
TntComboBox6.ItemIndex,nil);
if i>0 then
begin
SetLength(s,i);
if UTF16ToUTF32ForBS(Pointer(TmpUTFBS),Length(TmpUTFBS),
TntComboBox6.ItemIndex,Pointer(s))=i
then
begin
TmpUTFBS:=s;
DispBSCommonProc_10(6)
end;
TntRichEdit12.OnSelectionChange(TntRichEdit12);
TntRichEdit12.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-16编码格式字节序列转换为带或不带'+
'BOM的UTF-32编码格式字节序列','试练UTF16ToUTF32ForBS函数',mb_ok)
end
end;
procedure TForm1.TntButton35Click(Sender: TObject);
var
i:integer;
s:string;
begin
i:=UTF32ToUTF8ForBS(Pointer(TmpUTFBS),Length(TmpUTFBS),nil);
if i>0 then
begin
SetLength(s,i);
if UTF32ToUTF8ForBS(Pointer(TmpUTFBS),Length(TmpUTFBS),Pointer(s))=i then
begin
TmpUTFBS:=s;
DispBSCommonProc_10(4)
end;
TntRichEdit12.OnSelectionChange(TntRichEdit12);
TntRichEdit12.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-32编码格式字节序列转换为带BOM的'+
'UTF-8编码格式字节序列','试练UTF32ToUTF8ForBS函数',mb_ok)
end
end;
procedure TForm1.TntButton36Click(Sender: TObject);
var
i:integer;
s:string;
begin
i:=Length(TmpUTFBS);
if not (TBSType(GuessBSType(Pointer(TmpUTFBS),@i,80))
in [BS_UTF32Default..BS_UTF32LE])
then
InitGroupBox10_6;
i:=UTF32ToUTF16ForBS(Pointer(TmpUTFBS),Length(TmpUTFBS),
TntComboBox7.ItemIndex,nil);
if i>0 then
begin
SetLength(s,i);
if UTF32ToUTF16ForBS(Pointer(TmpUTFBS),Length(TmpUTFBS),
TntComboBox7.ItemIndex,Pointer(s))=i
then
begin
TmpUTFBS:=s;
DispBSCommonProc_10(5)
end;
TntRichEdit12.OnSelectionChange(TntRichEdit12);
TntRichEdit12.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-32编码格式字节序列转换为带或不带'+
'BOM的UTF-16编码格式字节序列','试练UTF32ToUTF16ForBS函数',mb_ok)
end
end;
procedure TForm1.TntTabSheet11Show(Sender: TObject);
var
i,c,c1:integer;
begin
TntRichEdit13.Text:=TntRichEdit1.Text;
TntRichEdit13.OnSelectionChange(TntRichEdit13);
TntRichEdit13.SetFocus;
TntRichEdit13.Tag:=0;
SetLength(RadioBtnArray,0);
SetLength(GroupBoxArray,0);
c:=0;
c1:=0;
for i:=0 to TntTabSheet11.ControlCount-1do
if TntTabSheet11.Controls is TTntRadioButton then
begin
inc(c);
SetLength(RadioBtnArray,c);
RadioBtnArray[c-1]:=TntTabSheet11.Controls as TTntRadioButton;
RadioBtnArray[c-1].Tag:=c-1;
GroupBoxArray[c-1].Enabled:=RadioBtnArray[c-1].Checked;
if GroupBoxArray[c-1].Enabled then
EnabGroupBoxIndex:=c-1
end
else
if TntTabSheet11.Controls is TTntGroupBox then
begin
inc(c1);
SetLength(GroupBoxArray,c1);
GroupBoxArray[c1-1]:=TntTabSheet11.Controls as TTntGroupBox
end
end;
procedure TForm1.TntRadioButton44Click(Sender: TObject);
var
i:integer;
begin
if Sender is TTntRadioButton then
begin
i:=(Sender as TTntRadioButton).Tag;
GroupBoxArray.Enabled:=true;
GroupBoxArray[EnabGroupBoxIndex].Enabled:=false;
EnabGroupBoxIndex:=i;
case EnabGroupBoxIndex of
0:
InitGroupBox11_4;
1:
InitGroupBox11_5;
2:
InitGroupBox11_6
end;
TntRichEdit13.SetFocus;
TntRichEdit13.OnSelectionChange(TntRichEdit13)
end
end;
procedure TForm1.TntRichEdit13Change(Sender: TObject);
begin
case EnabGroupBoxIndex of
0:
InitGroupBox11_4;
1:
InitGroupBox11_5;
2:
InitGroupBox11_6
end
end;
procedure TForm1.TntRichEdit13DblClick(Sender: TObject);
begin
TntRichEdit13.ReadOnly:=not TntRichEdit13.ReadOnly;
if TntRichEdit13.ReadOnly then
begin
TntRichEdit13.Cursor:=crArrow;
TntRichEdit13.OnSelectionChange(TntRichEdit13)
end
else
begin
TntRichEdit13.Cursor:=crDefault;
TntRichEdit13.SelLength:=0
end;
TntRichEdit14.HideSelection:=not TntRichEdit13.ReadOnly;
TntRichEdit13.Tag:=0
end;
procedure TForm1.TntRichEdit13SelectionChange(Sender: TObject);
label 10;
var
i,j,charsize:integer;
begin
if TntRichEdit13.ReadOnly then
if TntRichEdit13.Tag=0 then
begin
TntRichEdit13.Tag:=1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit13.Text),
TntRichEdit13.SelStart+1))=BMPCP
then
TntRichEdit13.SelLength:=1
else
TntRichEdit13.SelLength:=2;
if TntRichEdit14.Tag<>1 then
begin
TntGroupBox14.Tag:=TntRichEdit14.Tag;
TntRichEdit14.Tag:=1;
case TntGroupBox14.Tag of
0:
begin
TntRichEdit14.SelStart:=TntRichEdit13.SelStart*5;
if TntRichEdit13.SelLength=1 then
TntRichEdit14.SelLength:=4
else
TntRichEdit14.SelLength:=9
end;
2:
begin
TntButton25.Tag:=0;
10:
i:=UTF16CUToCharIndex(Pointer(TntRichEdit13.Text),
TntRichEdit13.SelStart+1,true);
i:=UTF8CharToCUIndex(Pointer(TmpUTF8Str),i,true);
UTF8CUIndexOfChar(Pointer(TmpUTF8Str),i,@j,@charsize);
i:=i+BOMSizeOfUTF8*TntButton25.Tag;
TntRichEdit14.SelStart:=(i-1)*3;
TntRichEdit14.SelLength:=(charsize-1)*3+2
end;
3:
begin
i:=TntRichEdit13.SelStart+1;
i:=UTF16CUToCharIndex(Pointer(TntRichEdit13.Text),i,true);
TntRichEdit14.SelStart:=(i-1)*9;
TntRichEdit14.SelLength:=8
end;
4:
begin
TntButton25.Tag:=BOMTypeOfUTF8BS(Pointer(TmpUTFBS));
goto 10
end;
5:
begin
TntButton27.Tag:=BOMTypeOfUTF16BS(Pointer(TmpUTFBS),Length(
TmpUTFBS));
if TntButton27.Tag>0 then
i:=TntRichEdit13.SelStart+1
else
i:=TntRichEdit13.SelStart;
TntRichEdit14.SelStart:=i*2*3;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit13.Text),
TntRichEdit13.SelStart+1))=BMPCP
then
TntRichEdit14.SelLength:=5
else
TntRichEdit14.SelLength:=11
end;
6:
begin
TntButton29.Tag:=BOMTypeOfUTF32BS(Pointer(TmpUTFBS),Length(
TmpUTFBS));
i:=UTF16CUToCharIndex(Pointer(TntRichEdit13.Text),
TntRichEdit13.SelStart+1,true)-1;
if TntButton29.Tag>0 then
inc(i);
TntRichEdit14.SelStart:=i*4*3;
TntRichEdit14.SelLength:=11
end
end
end
end
else
if TntRichEdit13.SelLength>0 then
TntRichEdit13.Tag:=0
end;
procedure TForm1.TntRichEdit14SelectionChange(Sender: TObject);
label 10;
var
i,j:integer;
begin
if TntRichEdit14.Tag<>1 then
TntGroupBox14.Tag:=TntRichEdit14.Tag;
case TntRichEdit14.Tag of
0:
begin
i:=TntRichEdit14.SelStart div 5 + 1;
TntRichEdit14.Tag:=1;
TntRichEdit14.SelStart:=(i-1)*5;
TntRichEdit14.SelLength:=4;
j:=UTF16CUIndexOfChar(Pointer(TntRichEdit13.Text),i,@j);
TntRichEdit13.Tag:=1;
TntRichEdit13.SelStart:=i-j;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit13.Text),i))=BMPCP then
TntRichEdit13.SelLength:=1
else
TntRichEdit13.SelLength:=2
end;
2:
begin
TntButton25.Tag:=0;
10:
i:=TntRichEdit14.SelStart div 3 + 1;
TntRichEdit14.Tag:=1;
TntRichEdit14.SelStart:=(i-1)*3;
TntRichEdit14.SelLength:=2;
if (TntButton25.Tag=1) and (i<=BOMSizeOfUTF8) then
begin
TntRichEdit13.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-8编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit13.HideSelection:=false;
i:=i-BOMSizeOfUTF8*TntButton25.Tag;
if not TntRichEdit13.HideSelection then
begin
i:=UTF8CUToCharIndex(Pointer(TmpUTF8Str),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit13.Text),i,true);
TntRichEdit13.Tag:=1;
TntRichEdit13.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit13.Text),i))=BMPCP then
TntRichEdit13.SelLength:=1
else
TntRichEdit13.SelLength:=2
end
end;
3:
begin
i:=TntRichEdit14.SelStart div 9 + 1;
TntRichEdit14.Tag:=1;
TntRichEdit14.SelStart:=(i-1)*9;
TntRichEdit14.SelLength:=8;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit13.Text),i,true);
TntRichEdit13.Tag:=1;
TntRichEdit13.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit13.Text),i))=BMPCP then
TntRichEdit13.SelLength:=1
else
TntRichEdit13.SelLength:=2
end;
4:
begin
TntButton25.Tag:=BOMTypeOfUTF8BS(Pointer(TmpUTFBS));
goto 10
end;
5:
begin
TntButton27.Tag:=BOMTypeOfUTF16BS(Pointer(TmpUTFBS),Length(TmpUTFBS));
i:=TntRichEdit14.SelStart div 3 + 1;
TntRichEdit14.Tag:=1;
TntRichEdit14.SelStart:=(i-1)*3;
TntRichEdit14.SelLength:=2;
if TntButton27.Tag>0 then
begin
if i<=BOMSizeOfUTF16 then
begin
TntRichEdit13.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-16编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit13.HideSelection:=false;
i:=i-BOMSizeOfUTF16
end
else
TntRichEdit13.HideSelection:=false;
if not TntRichEdit13.HideSelection then
begin
i:=(i-1) div 2 + 1;
i:=UTF16CUToCharIndex(Pointer(TntRichEdit13.Text),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit13.Text),i,true);
TntRichEdit13.Tag:=1;
TntRichEdit13.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit13.Text),i))=BMPCP then
TntRichEdit13.SelLength:=1
else
TntRichEdit13.SelLength:=2
end
end;
6:
begin
TntButton29.Tag:=BOMTypeOfUTF32BS(Pointer(TmpUTFBS),Length(TmpUTFBS));
i:=TntRichEdit14.SelStart div 3 + 1;
TntRichEdit14.Tag:=1;
TntRichEdit14.SelStart:=(i-1)*3;
TntRichEdit14.SelLength:=2;
if TntButton29.Tag>0 then
begin
if i<=BOMSizeOfUTF32 then
begin
TntRichEdit13.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-32编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit13.HideSelection:=false;
i:=i-BOMSizeOfUTF32
end
else
TntRichEdit13.HideSelection:=false;
if not TntRichEdit13.HideSelection then
begin
i:=(i-1) div 4 + 1;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit13.Text),i,true);
TntRichEdit13.Tag:=1;
TntRichEdit13.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit13.Text),i))=BMPCP then
TntRichEdit13.SelLength:=1
else
TntRichEdit13.SelLength:=2
end
end;
1:
if TntRichEdit14.SelLength>0 then
TntRichEdit14.Tag:=TntGroupBox14.Tag
end;
TntRichEdit13.Tag:=0
end;
procedure TForm1.TntButton37Click(Sender: TObject);
var
s:WideString;
begin
s:='当前UTF-8编码格式字节序列中共有'+inttostr(CharCountOfUTF8BS(Pointer(
TmpUTFBS)))+'个字符';
MessageBoxW(Form1.Handle,Pointer(s),'试练CharCountOfUTF8BS函数',
mb_ok)
end;
procedure TForm1.TntButton38Click(Sender: TObject);
var
s:WideString;
begin
s:='当前UTF-16编码格式字节序列中共有'+inttostr(CharCountOfUTF16BS(Pointer(
TmpUTFBS),Length(TmpUTFBS)))+'个字符';
MessageBoxW(Form1.Handle,Pointer(s),'试练CharCountOfUTF16BS函数',
mb_ok)
end;
procedure TForm1.TntButton39Click(Sender: TObject);
var
s:WideString;
begin
s:='当前UTF-32编码格式字节序列中共有'+inttostr(CharCountOfUTF32BS(Pointer(
TmpUTFBS),Length(TmpUTFBS)))+'个字符';
MessageBoxW(Form1.Handle,Pointer(s),'试练CharCountOfUTF32BS函数',
mb_ok)
end;
procedure TForm1.TntTabSheet12Show(Sender: TObject);
var
i,c,c1:integer;
begin
TntRichEdit15.Text:=TntRichEdit1.Text;
TntRichEdit15.OnSelectionChange(TntRichEdit15);
TntRichEdit15.SetFocus;
TntRichEdit15.Tag:=0;
SetLength(RadioBtnArray,0);
SetLength(GroupBoxArray,0);
c:=0;
c1:=0;
for i:=0 to TntTabSheet12.ControlCount-1do
if TntTabSheet12.Controls is TTntRadioButton then
begin
inc(c);
SetLength(RadioBtnArray,c);
RadioBtnArray[c-1]:=TntTabSheet12.Controls as TTntRadioButton;
RadioBtnArray[c-1].Tag:=c-1;
GroupBoxArray[c-1].Enabled:=RadioBtnArray[c-1].Checked;
if GroupBoxArray[c-1].Enabled then
EnabGroupBoxIndex:=c-1
end
else
if TntTabSheet12.Controls is TTntGroupBox then
begin
inc(c1);
SetLength(GroupBoxArray,c1);
GroupBoxArray[c1-1]:=TntTabSheet12.Controls as TTntGroupBox
end
end;
procedure TForm1.TntRichEdit15Change(Sender: TObject);
begin
case EnabGroupBoxIndex of
0,1:
InitGroupBox12_2;
2,3:
InitGroupBox12_1;
4,5:
InitGroupBox12_3
end
end;
procedure TForm1.TntRichEdit15DblClick(Sender: TObject);
begin
TntRichEdit15.ReadOnly:=not TntRichEdit15.ReadOnly;
if TntRichEdit15.ReadOnly then
begin
TntRichEdit15.Cursor:=crArrow;
TntRichEdit15.OnSelectionChange(TntRichEdit15)
end
else
begin
TntRichEdit15.Cursor:=crDefault;
TntRichEdit15.SelLength:=0
end;
TntRichEdit16.HideSelection:=not TntRichEdit15.ReadOnly;
TntRichEdit15.Tag:=0
end;
procedure TForm1.TntRichEdit15SelectionChange(Sender: TObject);
label 10;
var
i,j,charsize:integer;
begin
if TntRichEdit15.ReadOnly then
if TntRichEdit15.Tag=0 then
begin
TntRichEdit15.Tag:=1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit15.Text),
TntRichEdit15.SelStart+1))=BMPCP
then
TntRichEdit15.SelLength:=1
else
TntRichEdit15.SelLength:=2;
if TntRichEdit16.Tag<>1 then
begin
TntGroupBox14.Tag:=TntRichEdit16.Tag;
TntRichEdit16.Tag:=1;
case TntGroupBox14.Tag of
0:
begin
TntRichEdit16.SelStart:=TntRichEdit15.SelStart*5;
if TntRichEdit15.SelLength=1 then
TntRichEdit16.SelLength:=4
else
TntRichEdit16.SelLength:=9
end;
2:
begin
TntButton25.Tag:=0;
10:
i:=UTF16CUToCharIndex(Pointer(TntRichEdit15.Text),
TntRichEdit15.SelStart+1,true);
i:=UTF8CharToCUIndex(Pointer(TmpUTF8Str),i,true);
UTF8CUIndexOfChar(Pointer(TmpUTF8Str),i,@j,@charsize);
i:=i+BOMSizeOfUTF8*TntButton25.Tag;
TntRichEdit16.SelStart:=(i-1)*3;
TntRichEdit16.SelLength:=(charsize-1)*3+2
end;
3:
begin
i:=TntRichEdit15.SelStart+1;
i:=UTF16CUToCharIndex(Pointer(TntRichEdit15.Text),i,true);
TntRichEdit16.SelStart:=(i-1)*9;
TntRichEdit16.SelLength:=8
end;
4:
begin
TntButton25.Tag:=BOMTypeOfUTF8BS(Pointer(TmpUTFBS));
goto 10
end;
5:
begin
TntButton27.Tag:=BOMTypeOfUTF16BS(Pointer(TmpUTFBS),Length(
TmpUTFBS));
if TntButton27.Tag>0 then
i:=TntRichEdit15.SelStart+1
else
i:=TntRichEdit15.SelStart;
TntRichEdit16.SelStart:=i*2*3;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit15.Text),
TntRichEdit15.SelStart+1))=BMPCP
then
TntRichEdit16.SelLength:=5
else
TntRichEdit16.SelLength:=11
end;
6:
begin
TntButton29.Tag:=BOMTypeOfUTF32BS(Pointer(TmpUTFBS),Length(
TmpUTFBS));
i:=UTF16CUToCharIndex(Pointer(TntRichEdit15.Text),
TntRichEdit15.SelStart+1,true)-1;
if TntButton29.Tag>0 then
inc(i);
TntRichEdit16.SelStart:=i*4*3;
TntRichEdit16.SelLength:=11
end
end
end
end
else
if TntRichEdit15.SelLength>0 then
TntRichEdit15.Tag:=0
end;
procedure TForm1.TntRichEdit16SelectionChange(Sender: TObject);
label 10;
var
i,j:integer;
begin
if TntRichEdit16.Tag<>1 then
TntGroupBox14.Tag:=TntRichEdit16.Tag;
case TntRichEdit16.Tag of
0:
begin
i:=TntRichEdit16.SelStart div 5 + 1;
TntRichEdit16.Tag:=1;
TntRichEdit16.SelStart:=(i-1)*5;
TntRichEdit16.SelLength:=4;
j:=UTF16CUIndexOfChar(Pointer(TntRichEdit15.Text),i,@j);
TntRichEdit15.Tag:=1;
TntRichEdit15.SelStart:=i-j;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit15.Text),i))=BMPCP then
TntRichEdit15.SelLength:=1
else
TntRichEdit15.SelLength:=2
end;
2:
begin
TntButton25.Tag:=0;
10:
i:=TntRichEdit16.SelStart div 3 + 1;
TntRichEdit16.Tag:=1;
TntRichEdit16.SelStart:=(i-1)*3;
TntRichEdit16.SelLength:=2;
if (TntButton25.Tag=1) and (i<=BOMSizeOfUTF8) then
begin
TntRichEdit15.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-8编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit15.HideSelection:=false;
i:=i-BOMSizeOfUTF8*TntButton25.Tag;
if not TntRichEdit15.HideSelection then
begin
i:=UTF8CUToCharIndex(Pointer(TmpUTF8Str),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit15.Text),i,true);
TntRichEdit15.Tag:=1;
TntRichEdit15.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit15.Text),i))=BMPCP then
TntRichEdit15.SelLength:=1
else
TntRichEdit15.SelLength:=2
end
end;
3:
begin
i:=TntRichEdit16.SelStart div 9 + 1;
TntRichEdit16.Tag:=1;
TntRichEdit16.SelStart:=(i-1)*9;
TntRichEdit16.SelLength:=8;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit15.Text),i,true);
TntRichEdit15.Tag:=1;
TntRichEdit15.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit15.Text),i))=BMPCP then
TntRichEdit15.SelLength:=1
else
TntRichEdit15.SelLength:=2
end;
4:
begin
TntButton25.Tag:=BOMTypeOfUTF8BS(Pointer(TmpUTFBS));
goto 10
end;
5:
begin
TntButton27.Tag:=BOMTypeOfUTF16BS(Pointer(TmpUTFBS),Length(TmpUTFBS));
i:=TntRichEdit16.SelStart div 3 + 1;
TntRichEdit16.Tag:=1;
TntRichEdit16.SelStart:=(i-1)*3;
TntRichEdit16.SelLength:=2;
if TntButton27.Tag>0 then
begin
if i<=BOMSizeOfUTF16 then
begin
TntRichEdit15.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-16编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit15.HideSelection:=false;
i:=i-BOMSizeOfUTF16
end
else
TntRichEdit15.HideSelection:=false;
if not TntRichEdit15.HideSelection then
begin
i:=(i-1) div 2 + 1;
i:=UTF16CUToCharIndex(Pointer(TntRichEdit15.Text),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit15.Text),i,true);
TntRichEdit15.Tag:=1;
TntRichEdit15.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit15.Text),i))=BMPCP then
TntRichEdit15.SelLength:=1
else
TntRichEdit15.SelLength:=2
end
end;
6:
begin
TntButton29.Tag:=BOMTypeOfUTF32BS(Pointer(TmpUTFBS),Length(TmpUTFBS));
i:=TntRichEdit16.SelStart div 3 + 1;
TntRichEdit16.Tag:=1;
TntRichEdit16.SelStart:=(i-1)*3;
TntRichEdit16.SelLength:=2;
if TntButton29.Tag>0 then
begin
if i<=BOMSizeOfUTF32 then
begin
TntRichEdit15.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-32编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit15.HideSelection:=false;
i:=i-BOMSizeOfUTF32
end
else
TntRichEdit15.HideSelection:=false;
if not TntRichEdit15.HideSelection then
begin
i:=(i-1) div 4 + 1;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit15.Text),i,true);
TntRichEdit15.Tag:=1;
TntRichEdit15.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit15.Text),i))=BMPCP then
TntRichEdit15.SelLength:=1
else
TntRichEdit15.SelLength:=2
end
end;
1:
if TntRichEdit16.SelLength>0 then
TntRichEdit16.Tag:=TntGroupBox14.Tag
end;
TntRichEdit15.Tag:=0
end;
procedure TForm1.TntRadioButton47Click(Sender: TObject);
var
i:integer;
begin
if Sender is TTntRadioButton then
begin
i:=(Sender as TTntRadioButton).Tag;
GroupBoxArray.Enabled:=true;
GroupBoxArray[EnabGroupBoxIndex].Enabled:=false;
EnabGroupBoxIndex:=i;
case EnabGroupBoxIndex of
0,1:
InitGroupBox12_2;
2,3:
InitGroupBox12_1;
4,5:
InitGroupBox12_3
end;
TntRichEdit15.SetFocus;
TntRichEdit15.OnSelectionChange(TntRichEdit15)
end
end;
procedure TForm1.TntButton40Click(Sender: TObject);
var
i:integer;
begin
i:=UTF8CUSToUTF16BS(Pointer(TmpUTF8Str),TntComboBox8.ItemIndex,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF8CUSToUTF16BS(Pointer(TmpUTF8Str),TntComboBox8.ItemIndex,Pointer(
TmpUTFBS))=i
then
begin
DispBSCommonProc_12(5);
TntRichEdit16.OnSelectionChange(TntRichEdit16);
TntRichEdit16.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-8编码单元序列转换为带或不带BOM'+
'的UTF-16编码格式字节序列','试练UTF8CUSToUTF16BS函数',mb_ok)
end
end
end;
procedure TForm1.TntButton41Click(Sender: TObject);
var
i:integer;
begin
i:=UTF8CUSToUTF32BS(Pointer(TmpUTF8Str),TntComboBox9.ItemIndex,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF8CUSToUTF32BS(Pointer(TmpUTF8Str),TntComboBox9.ItemIndex,Pointer(
TmpUTFBS))=i
then
begin
DispBSCommonProc_12(6);
TntRichEdit16.OnSelectionChange(TntRichEdit16);
TntRichEdit16.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-8编码单元序列转换为带或不带BOM'+
'的UTF-32编码格式字节序列','试练UTF8CUSToUTF32BS函数',mb_ok)
end
end
end;
procedure TForm1.TntButton42Click(Sender: TObject);
var
i:integer;
begin
i:=UTF16CUSToUTF8BS(Pointer(TntRichEdit15.Text),nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF16CUSToUTF8BS(Pointer(TntRichEdit15.Text),Pointer(TmpUTFBS))=i then
begin
DispBSCommonProc_12(4);
TntRichEdit16.OnSelectionChange(TntRichEdit16);
TntRichEdit16.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-16编码单元序列转换为UTF-8编码'+
'格式字节序列','试练UTF16CUSToUTF8BS函数',mb_ok)
end
end
end;
procedure TForm1.TntButton43Click(Sender: TObject);
var
i:integer;
begin
i:=UTF16CUSToUTF32BS(Pointer(TntRichEdit15.Text),TntComboBox10.ItemIndex,
nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF16CUSToUTF32BS(Pointer(TntRichEdit15.Text),TntComboBox10.ItemIndex,
Pointer(TmpUTFBS))=i
then
begin
DispBSCommonProc_12(6);
TntRichEdit16.OnSelectionChange(TntRichEdit16);
TntRichEdit16.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-16编码单元序列转换为带或不带BOM'+
'的UTF-32编码格式字节序列','试练UTF16CUSToUTF32BS函数',mb_ok)
end
end
end;
procedure TForm1.TntButton44Click(Sender: TObject);
var
i:integer;
begin
i:=UTF32CUSToUTF8BS(@TmpUTF32Str[0],nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF32CUSToUTF8BS(@TmpUTF32Str[0],Pointer(TmpUTFBS))=i then
begin
DispBSCommonProc_12(4);
TntRichEdit16.OnSelectionChange(TntRichEdit16);
TntRichEdit16.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-32编码单元序列转换为UTF-8编码'+
'格式字节序列','试练UTF32CUSToUTF8BS函数',mb_ok)
end
end
end;
procedure TForm1.TntButton45Click(Sender: TObject);
var
i:integer;
begin
i:=UTF32CUSToUTF16BS(@TmpUTF32Str[0],TntComboBox11.ItemIndex,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF32CUSToUTF16BS(@TmpUTF32Str[0],TntComboBox11.ItemIndex,Pointer(
TmpUTFBS))=i
then
begin
DispBSCommonProc_12(5);
TntRichEdit16.OnSelectionChange(TntRichEdit16);
TntRichEdit16.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把UTF-32编码单元序列转换为带或不带BOM'+
'的UTF-16编码格式字节序列','试练UTF32CUSToUTF16BS函数',mb_ok)
end
end
end;
procedure TForm1.TntTabSheet13Show(Sender: TObject);
var
i,c,c1:integer;
begin
TntRichEdit17.Text:=TntRichEdit1.Text;
TntRichEdit17.OnSelectionChange(TntRichEdit17);
TntRichEdit17.SetFocus;
TntRichEdit17.Tag:=0;
SetLength(RadioBtnArray,0);
SetLength(GroupBoxArray,0);
c:=0;
c1:=0;
for i:=0 to TntTabSheet13.ControlCount-1do
if TntTabSheet13.Controls is TTntRadioButton then
begin
inc(c);
SetLength(RadioBtnArray,c);
RadioBtnArray[c-1]:=TntTabSheet13.Controls as TTntRadioButton;
RadioBtnArray[c-1].Tag:=c-1;
GroupBoxArray[c-1].Enabled:=RadioBtnArray[c-1].Checked;
if GroupBoxArray[c-1].Enabled then
EnabGroupBoxIndex:=c-1
end
else
if TntTabSheet13.Controls is TTntGroupBox then
begin
inc(c1);
SetLength(GroupBoxArray,c1);
GroupBoxArray[c1-1]:=TntTabSheet13.Controls as TTntGroupBox
end
end;
procedure TForm1.TntRichEdit17Change(Sender: TObject);
begin
case EnabGroupBoxIndex of
0,1:
InitGroupBox13_4;
2,3:
InitGroupBox13_5;
4,5:
InitGroupBox13_6
end
end;
procedure TForm1.TntRichEdit17DblClick(Sender: TObject);
begin
TntRichEdit17.ReadOnly:=not TntRichEdit17.ReadOnly;
if TntRichEdit17.ReadOnly then
begin
TntRichEdit17.Cursor:=crArrow;
TntRichEdit17.OnSelectionChange(TntRichEdit17)
end
else
begin
TntRichEdit17.Cursor:=crDefault;
TntRichEdit17.SelLength:=0
end;
TntRichEdit18.HideSelection:=not TntRichEdit17.ReadOnly;
TntRichEdit17.Tag:=0
end;
procedure TForm1.TntRichEdit17SelectionChange(Sender: TObject);
label 10;
var
i,j,charsize:integer;
begin
if TntRichEdit17.ReadOnly then
if TntRichEdit17.Tag=0 then
begin
TntRichEdit17.Tag:=1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit17.Text),
TntRichEdit17.SelStart+1))=BMPCP
then
TntRichEdit17.SelLength:=1
else
TntRichEdit17.SelLength:=2;
if TntRichEdit18.Tag<>1 then
begin
TntGroupBox14.Tag:=TntRichEdit18.Tag;
TntRichEdit18.Tag:=1;
case TntGroupBox14.Tag of
0:
begin
TntRichEdit18.SelStart:=TntRichEdit17.SelStart*5;
if TntRichEdit17.SelLength=1 then
TntRichEdit18.SelLength:=4
else
TntRichEdit18.SelLength:=9
end;
2:
begin
TntButton25.Tag:=0;
10:
i:=UTF16CUToCharIndex(Pointer(TntRichEdit17.Text),
TntRichEdit17.SelStart+1,true);
i:=UTF8CharToCUIndex(Pointer(TmpUTF8Str),i,true);
UTF8CUIndexOfChar(Pointer(TmpUTF8Str),i,@j,@charsize);
i:=i+BOMSizeOfUTF8*TntButton25.Tag;
TntRichEdit18.SelStart:=(i-1)*3;
TntRichEdit18.SelLength:=(charsize-1)*3+2
end;
3:
begin
i:=TntRichEdit17.SelStart+1;
i:=UTF16CUToCharIndex(Pointer(TntRichEdit17.Text),i,true);
TntRichEdit18.SelStart:=(i-1)*9;
TntRichEdit18.SelLength:=8
end;
4:
begin
TntButton25.Tag:=BOMTypeOfUTF8BS(Pointer(TmpUTFBS));
goto 10
end;
5:
begin
TntButton27.Tag:=BOMTypeOfUTF16BS(Pointer(TmpUTFBS),Length(
TmpUTFBS));
if TntButton27.Tag>0 then
i:=TntRichEdit17.SelStart+1
else
i:=TntRichEdit17.SelStart;
TntRichEdit18.SelStart:=i*2*3;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit17.Text),
TntRichEdit17.SelStart+1))=BMPCP
then
TntRichEdit18.SelLength:=5
else
TntRichEdit18.SelLength:=11
end;
6:
begin
TntButton29.Tag:=BOMTypeOfUTF32BS(Pointer(TmpUTFBS),Length(
TmpUTFBS));
i:=UTF16CUToCharIndex(Pointer(TntRichEdit17.Text),
TntRichEdit17.SelStart+1,true)-1;
if TntButton29.Tag>0 then
inc(i);
TntRichEdit18.SelStart:=i*4*3;
TntRichEdit18.SelLength:=11
end
end
end
end
else
if TntRichEdit17.SelLength>0 then
TntRichEdit17.Tag:=0
end;
procedure TForm1.TntRichEdit18SelectionChange(Sender: TObject);
label 10;
var
i,j:integer;
begin
if TntRichEdit18.Tag<>1 then
TntGroupBox14.Tag:=TntRichEdit18.Tag;
case TntRichEdit18.Tag of
0:
begin
i:=TntRichEdit18.SelStart div 5 + 1;
TntRichEdit18.Tag:=1;
TntRichEdit18.SelStart:=(i-1)*5;
TntRichEdit18.SelLength:=4;
j:=UTF16CUIndexOfChar(Pointer(TntRichEdit17.Text),i,@j);
TntRichEdit17.Tag:=1;
TntRichEdit17.SelStart:=i-j;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit17.Text),i))=BMPCP then
TntRichEdit17.SelLength:=1
else
TntRichEdit17.SelLength:=2
end;
2:
begin
TntButton25.Tag:=0;
10:
i:=TntRichEdit18.SelStart div 3 + 1;
TntRichEdit18.Tag:=1;
TntRichEdit18.SelStart:=(i-1)*3;
TntRichEdit18.SelLength:=2;
if (TntButton25.Tag=1) and (i<=BOMSizeOfUTF8) then
begin
TntRichEdit17.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-8编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit17.HideSelection:=false;
i:=i-BOMSizeOfUTF8*TntButton25.Tag;
if not TntRichEdit17.HideSelection then
begin
i:=UTF8CUToCharIndex(Pointer(TmpUTF8Str),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit17.Text),i,true);
TntRichEdit17.Tag:=1;
TntRichEdit17.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit17.Text),i))=BMPCP then
TntRichEdit17.SelLength:=1
else
TntRichEdit17.SelLength:=2
end
end;
3:
begin
i:=TntRichEdit18.SelStart div 9 + 1;
TntRichEdit18.Tag:=1;
TntRichEdit18.SelStart:=(i-1)*9;
TntRichEdit18.SelLength:=8;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit17.Text),i,true);
TntRichEdit17.Tag:=1;
TntRichEdit17.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit17.Text),i))=BMPCP then
TntRichEdit17.SelLength:=1
else
TntRichEdit17.SelLength:=2
end;
4:
begin
TntButton25.Tag:=BOMTypeOfUTF8BS(Pointer(TmpUTFBS));
goto 10
end;
5:
begin
TntButton27.Tag:=BOMTypeOfUTF16BS(Pointer(TmpUTFBS),Length(TmpUTFBS));
i:=TntRichEdit18.SelStart div 3 + 1;
TntRichEdit18.Tag:=1;
TntRichEdit18.SelStart:=(i-1)*3;
TntRichEdit18.SelLength:=2;
if TntButton27.Tag>0 then
begin
if i<=BOMSizeOfUTF16 then
begin
TntRichEdit17.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-16编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit17.HideSelection:=false;
i:=i-BOMSizeOfUTF16
end
else
TntRichEdit17.HideSelection:=false;
if not TntRichEdit17.HideSelection then
begin
i:=(i-1) div 2 + 1;
i:=UTF16CUToCharIndex(Pointer(TntRichEdit17.Text),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit17.Text),i,true);
TntRichEdit17.Tag:=1;
TntRichEdit17.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit17.Text),i))=BMPCP then
TntRichEdit17.SelLength:=1
else
TntRichEdit17.SelLength:=2
end
end;
6:
begin
TntButton29.Tag:=BOMTypeOfUTF32BS(Pointer(TmpUTFBS),Length(TmpUTFBS));
i:=TntRichEdit18.SelStart div 3 + 1;
TntRichEdit18.Tag:=1;
TntRichEdit18.SelStart:=(i-1)*3;
TntRichEdit18.SelLength:=2;
if TntButton29.Tag>0 then
begin
if i<=BOMSizeOfUTF32 then
begin
TntRichEdit17.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-32编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit17.HideSelection:=false;
i:=i-BOMSizeOfUTF32
end
else
TntRichEdit17.HideSelection:=false;
if not TntRichEdit17.HideSelection then
begin
i:=(i-1) div 4 + 1;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit17.Text),i,true);
TntRichEdit17.Tag:=1;
TntRichEdit17.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit17.Text),i))=BMPCP then
TntRichEdit17.SelLength:=1
else
TntRichEdit17.SelLength:=2
end
end;
1:
if TntRichEdit18.SelLength>0 then
TntRichEdit18.Tag:=TntGroupBox14.Tag
end;
TntRichEdit17.Tag:=0
end;
procedure TForm1.TntRadioButton53Click(Sender: TObject);
var
i:integer;
begin
if Sender is TTntRadioButton then
begin
i:=(Sender as TTntRadioButton).Tag;
GroupBoxArray.Enabled:=true;
GroupBoxArray[EnabGroupBoxIndex].Enabled:=false;
EnabGroupBoxIndex:=i;
case EnabGroupBoxIndex of
0,1:
InitGroupBox13_4;
2,3:
begin
if EnabGroupBoxIndex=2 then
TntComboBox12.Tag:=TntComboBox12.ItemIndex
else
TntComboBox12.Tag:=TntComboBox14.ItemIndex;
InitGroupBox13_5
end;
4,5:
begin
if EnabGroupBoxIndex=4 then
TntComboBox13.Tag:=TntComboBox13.ItemIndex
else
TntComboBox13.Tag:=TntComboBox15.ItemIndex;
InitGroupBox13_6
end
end;
TntRichEdit17.SetFocus;
TntRichEdit17.OnSelectionChange(TntRichEdit17)
end
end;
procedure TForm1.TntButton46Click(Sender: TObject);
var
i,j,k:integer;
s:WideString;
s1:string;
pChar;
cp:WORD;
b:Byte;
begin
i:=UTF8BSToUTF16CUS(Pointer(TmpUTFBS),nil);
if i>0 then
begin
SetLength(s,i);
if UTF8BSToUTF16CUS(Pointer(TmpUTFBS),Pointer(s))=i then
begin
SetLength(s1,5*i);
p:=Pointer(s1);
j:=0;
for i:=1 to ido
begin
cp:=ord(s);
for k:=3do
wnto 0do
begin
b:=cp shr (4*k) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j)
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit18.Tag:=0;
TntRichEdit18.Text:=s1;
TntRichEdit18.OnSelectionChange(TntRichEdit18);
TntRichEdit18.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把一个UTF-8编码格式字节序列转换为'+
'UTF-16编码单元序列','试练UTF8BSToUTF16CUS函数',mb_ok)
end
end
end;
procedure TForm1.TntButton47Click(Sender: TObject);
var
i,j,k:integer;
s:string;
pChar;
cpWORD;
b:Byte;
begin
i:=UTF8BSToUTF32CUS(Pointer(TmpUTFBS),nil);
if i>0 then
begin
SetLength(TmpUTF32Str,i);
if UTF8BSToUTF32CUS(Pointer(TmpUTFBS),@TmpUTF32Str[0])=i-1 then
begin
SetLength(s,9*i);
p:=Pointer(s);
j:=0;
for i:=0 to i-2do
begin
cp:=ord(TmpUTF32Str);
for k:=7do
wnto 0do
begin
b:=cp shr (4*k) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j)
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit18.Tag:=3;
TntRichEdit18.Text:=s;
TntRichEdit18.OnSelectionChange(TntRichEdit18);
TntRichEdit18.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把一个UTF-8编码格式字节序列转换为'+
'UTF-32编码单元序列','试练UTF8BSToUTF32CUS函数',mb_ok)
end
end
end;
procedure TForm1.TntComboBox12Select(Sender: TObject);
var
i:integer;
begin
if Sender is TTntComboBox then
begin
case EnabGroupBoxIndex of
2,3:
begin
i:=CUSToBSForUTF16(Pointer(TntRichEdit17.Text),(Sender as
TTntComboBox).ItemIndex,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if CUSToBSForUTF16(Pointer(TntRichEdit17.Text),(Sender as
TTntComboBox).ItemIndex,Pointer(TmpUTFBS))=i
then
DispBSCommonProc_13(5)
end
end;
4,5:
begin
i:=UTF16CUSToUTF32BS(Pointer(TntRichEdit17.Text),(Sender as
TTntComboBox).ItemIndex,nil);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if UTF16CUSToUTF32BS(Pointer(TntRichEdit17.Text),(Sender as
TTntComboBox).ItemIndex,Pointer(TmpUTFBS))=i
then
DispBSCommonProc_13(6)
end
end
end;
TntRichEdit18.OnSelectionChange(TntRichEdit18);
TntRichEdit18.SetFocus
end
end;
procedure TForm1.TntButton48Click(Sender: TObject);
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=UTF16BSToUTF8CUS(Pointer(TmpUTFBS),Length(TmpUTFBS),nil);
if i>0 then
begin
SetLength(TmpUTF8Str,i);
if UTF16BSToUTF8CUS(Pointer(TmpUTFBS),Length(TmpUTFBS),Pointer(
TmpUTF8Str))=i
then
begin
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTF8Str);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit18.Tag:=2;
TntRichEdit18.Text:=s;
TntRichEdit18.OnSelectionChange(TntRichEdit18);
TntRichEdit18.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把一个UTF-16编码格式直接序列转换为'+
'UTF-8编码单元序列','试练UTF16BSToUTF8CUS函数',mb_ok)
end
end
end;
procedure TForm1.TntButton49Click(Sender: TObject);
var
i,j,k:integer;
s:string;
pChar;
cpWORD;
b:Byte;
begin
i:=UTF16BSToUTF32CUS(Pointer(TmpUTFBS),Length(TmpUTFBS),nil);
if i>0 then
begin
SetLength(TmpUTF32Str,i);
if UTF16BSToUTF32CUS(Pointer(TmpUTFBS),Length(TmpUTFBS),@TmpUTF32Str[0])
=i-1
then
begin
SetLength(s,9*i);
p:=Pointer(s);
j:=0;
for i:=0 to i-2do
begin
cp:=ord(TmpUTF32Str);
for k:=7do
wnto 0do
begin
b:=cp shr (4*k) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j)
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit18.Tag:=3;
TntRichEdit18.Text:=s;
TntRichEdit18.OnSelectionChange(TntRichEdit18);
TntRichEdit18.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把一个UTF-16编码格式直接序列转换为'+
'UTF-32编码单元序列','试练UTF16BSToUTF32CUS函数',mb_ok)
end
end
end;
procedure TForm1.TntButton50Click(Sender: TObject);
var
i,j:integer;
s:string;
pChar;
b,b1:Byte;
begin
i:=UTF32BSToUTF8CUS(Pointer(TmpUTFBS),Length(TmpUTFBS),nil);
if i>0 then
begin
SetLength(TmpUTF8Str,i);
if UTF32BSToUTF8CUS(Pointer(TmpUTFBS),Length(TmpUTFBS),Pointer(
TmpUTF8Str))=i
then
begin
SetLength(s,3*i);
p:=Pointer(s);
j:=0;
for i:=1 to ido
begin
b:=ord(TmpUTF8Str);
b1:=b shr 4;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j]:=chr(b1);
b1:=b and $F;
if b1>9 then
b1:=b1+$37
else
b1:=b1+$30;
p[j+1]:=chr(b1);
p[j+2]:=#32;
j:=j+3
end;
TntRichEdit18.Tag:=2;
TntRichEdit18.Text:=s;
TntRichEdit18.OnSelectionChange(TntRichEdit18);
TntRichEdit18.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把一个UTF-32编码格式直接序列转换为'+
'UTF-8编码单元序列','试练UTF32BSToUTF8CUS函数',mb_ok)
end
end
end;
procedure TForm1.TntButton51Click(Sender: TObject);
var
i,j,k:integer;
s:WideString;
s1:string;
pChar;
cp:WORD;
b:Byte;
begin
i:=UTF32BSToUTF16CUS(Pointer(TmpUTFBS),Length(TmpUTFBS),nil);
if i>0 then
begin
SetLength(s,i);
if UTF32BSToUTF16CUS(Pointer(TmpUTFBS),Length(TmpUTFBS),Pointer(s))=i then
begin
SetLength(s1,5*i);
p:=Pointer(s1);
j:=0;
for i:=1 to ido
begin
cp:=ord(s);
for k:=3do
wnto 0do
begin
b:=cp shr (4*k) and $F;
if b>9 then
b:=b+$37
else
b:=b+$30;
p[j]:=chr(b);
inc(j)
end;
p[j]:=#32;
inc(j)
end;
TntRichEdit18.Tag:=0;
TntRichEdit18.Text:=s1;
TntRichEdit18.OnSelectionChange(TntRichEdit18);
TntRichEdit18.SetFocus;
MessageBoxW(Form1.Handle,'已经成功把一个UTF-32编码格式字节序列转换为'+
'UTF-16编码单元序列','试练UTF32BSToUTF16CUS函数',mb_ok)
end
end
end;
procedure TForm1.TntTabSheet14Show(Sender: TObject);
begin
TntRichEdit19.OnChange(TntRichEdit19);
TntRichEdit19.OnSelectionChange(TntRichEdit19);
TntRichEdit19.SetFocus;
TntRichEdit19.Tag:=0
end;
procedure TForm1.TntRichEdit19SelectionChange(Sender: TObject);
label 10;
var
i,j,charsize:integer;
begin
if TntRichEdit19.ReadOnly then
if TntRichEdit19.Tag=0 then
begin
TntRichEdit19.Tag:=1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit19.Text),
TntRichEdit19.SelStart+1))=BMPCP
then
TntRichEdit19.SelLength:=1
else
TntRichEdit19.SelLength:=2;
if TntRichEdit20.Tag<>1 then
begin
TntGroupBox14.Tag:=TntRichEdit20.Tag;
TntRichEdit20.Tag:=1;
case TntGroupBox14.Tag of
0:
begin
TntRichEdit20.SelStart:=TntRichEdit19.SelStart*5;
if TntRichEdit19.SelLength=1 then
TntRichEdit20.SelLength:=4
else
TntRichEdit20.SelLength:=9
end;
2:
begin
TntButton25.Tag:=0;
10:
i:=UTF16CUToCharIndex(Pointer(TntRichEdit19.Text),
TntRichEdit19.SelStart+1,true);
i:=UTF8CharToCUIndex(Pointer(TmpUTF8Str),i,true);
UTF8CUIndexOfChar(Pointer(TmpUTF8Str),i,@j,@charsize);
i:=i+BOMSizeOfUTF8*TntButton25.Tag;
TntRichEdit20.SelStart:=(i-1)*3;
TntRichEdit20.SelLength:=(charsize-1)*3+2
end;
3:
begin
i:=TntRichEdit19.SelStart+1;
i:=UTF16CUToCharIndex(Pointer(TntRichEdit19.Text),i,true);
TntRichEdit20.SelStart:=(i-1)*9;
TntRichEdit20.SelLength:=8
end;
4:
begin
TntButton25.Tag:=BOMTypeOfUTF8BS(Pointer(TmpUTFBS));
goto 10
end;
5:
begin
TntButton27.Tag:=BOMTypeOfUTF16BS(Pointer(TmpUTFBS),Length(
TmpUTFBS));
if TntButton27.Tag>0 then
i:=TntRichEdit19.SelStart+1
else
i:=TntRichEdit19.SelStart;
TntRichEdit20.SelStart:=i*2*3;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit19.Text),
TntRichEdit19.SelStart+1))=BMPCP
then
TntRichEdit20.SelLength:=5
else
TntRichEdit20.SelLength:=11
end;
6:
begin
TntButton29.Tag:=BOMTypeOfUTF32BS(Pointer(TmpUTFBS),Length(
TmpUTFBS));
i:=UTF16CUToCharIndex(Pointer(TntRichEdit19.Text),
TntRichEdit19.SelStart+1,true)-1;
if TntButton29.Tag>0 then
inc(i);
TntRichEdit20.SelStart:=i*4*3;
TntRichEdit20.SelLength:=11
end
end
end
end
else
if TntRichEdit19.SelLength>0 then
TntRichEdit19.Tag:=0
end;
procedure TForm1.TntRichEdit20SelectionChange(Sender: TObject);
label 10;
var
i,j:integer;
begin
if TntRichEdit20.Tag<>1 then
TntGroupBox14.Tag:=TntRichEdit20.Tag;
case TntRichEdit20.Tag of
0:
begin
i:=TntRichEdit20.SelStart div 5 + 1;
TntRichEdit20.Tag:=1;
TntRichEdit20.SelStart:=(i-1)*5;
TntRichEdit20.SelLength:=4;
j:=UTF16CUIndexOfChar(Pointer(TntRichEdit19.Text),i,@j);
TntRichEdit19.Tag:=1;
TntRichEdit19.SelStart:=i-j;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit19.Text),i))=BMPCP then
TntRichEdit19.SelLength:=1
else
TntRichEdit19.SelLength:=2
end;
2:
begin
TntButton25.Tag:=0;
10:
i:=TntRichEdit20.SelStart div 3 + 1;
TntRichEdit20.Tag:=1;
TntRichEdit20.SelStart:=(i-1)*3;
TntRichEdit20.SelLength:=2;
if (TntButton25.Tag=1) and (i<=BOMSizeOfUTF8) then
begin
TntRichEdit19.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-8编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit19.HideSelection:=false;
i:=i-BOMSizeOfUTF8*TntButton25.Tag;
if not TntRichEdit19.HideSelection then
begin
i:=UTF8CUToCharIndex(Pointer(TmpUTF8Str),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit19.Text),i,true);
TntRichEdit19.Tag:=1;
TntRichEdit19.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit19.Text),i))=BMPCP then
TntRichEdit19.SelLength:=1
else
TntRichEdit19.SelLength:=2
end
end;
3:
begin
i:=TntRichEdit20.SelStart div 9 + 1;
TntRichEdit20.Tag:=1;
TntRichEdit20.SelStart:=(i-1)*9;
TntRichEdit20.SelLength:=8;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit19.Text),i,true);
TntRichEdit19.Tag:=1;
TntRichEdit19.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit19.Text),i))=BMPCP then
TntRichEdit19.SelLength:=1
else
TntRichEdit19.SelLength:=2
end;
4:
begin
TntButton25.Tag:=BOMTypeOfUTF8BS(Pointer(TmpUTFBS));
goto 10
end;
5:
begin
TntButton27.Tag:=BOMTypeOfUTF16BS(Pointer(TmpUTFBS),Length(TmpUTFBS));
i:=TntRichEdit20.SelStart div 3 + 1;
TntRichEdit20.Tag:=1;
TntRichEdit20.SelStart:=(i-1)*3;
TntRichEdit20.SelLength:=2;
if TntButton27.Tag>0 then
begin
if i<=BOMSizeOfUTF16 then
begin
TntRichEdit19.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-16编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit19.HideSelection:=false;
i:=i-BOMSizeOfUTF16
end
else
TntRichEdit19.HideSelection:=false;
if not TntRichEdit19.HideSelection then
begin
i:=(i-1) div 2 + 1;
i:=UTF16CUToCharIndex(Pointer(TntRichEdit19.Text),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit19.Text),i,true);
TntRichEdit19.Tag:=1;
TntRichEdit19.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit19.Text),i))=BMPCP then
TntRichEdit19.SelLength:=1
else
TntRichEdit19.SelLength:=2
end
end;
6:
begin
TntButton29.Tag:=BOMTypeOfUTF32BS(Pointer(TmpUTFBS),Length(TmpUTFBS));
i:=TntRichEdit20.SelStart div 3 + 1;
TntRichEdit20.Tag:=1;
TntRichEdit20.SelStart:=(i-1)*3;
TntRichEdit20.SelLength:=2;
if TntButton29.Tag>0 then
begin
if i<=BOMSizeOfUTF32 then
begin
TntRichEdit19.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-32编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit19.HideSelection:=false;
i:=i-BOMSizeOfUTF32
end
else
TntRichEdit19.HideSelection:=false;
if not TntRichEdit19.HideSelection then
begin
i:=(i-1) div 4 + 1;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit19.Text),i,true);
TntRichEdit19.Tag:=1;
TntRichEdit19.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit19.Text),i))=BMPCP then
TntRichEdit19.SelLength:=1
else
TntRichEdit19.SelLength:=2
end
end;
1:
if TntRichEdit20.SelLength>0 then
TntRichEdit20.Tag:=TntGroupBox14.Tag
end;
TntRichEdit19.Tag:=0
end;
procedure TForm1.TntRichEdit19Change(Sender: TObject);
var
i:integer;
s:WideString;
begin
i:=Length(TmpUTFBS);
case TBSType(GuessBSType(Pointer(TmpUTFBS),@i,80)) of
BS_UTF8WithoutBOM,BS_UTF8WithBOM:
begin
i:=UTF8BSToUTF16CUS(Pointer(TmpUTFBS),nil);
if i>0 then
begin
SetLength(s,i);
if UTF8BSToUTF16CUS(Pointer(TmpUTFBS),Pointer(s))=i then
begin
TntRichEdit19.Text:=s;
TmpUTF8Str:=TmpUTFBS;
i:=4
end
else
i:=0
end
else
i:=0
end;
BS_UTF16Default..BS_UTF16LE:
begin
i:=BSToCUSForUTF16(Pointer(TmpUTFBS),Length(TmpUTFBS),nil);
if i>0 then
begin
SetLength(s,i);
if BSToCUSForUTF16(Pointer(TmpUTFBS),Length(TmpUTFBS),Pointer(s))=i then
begin
TntRichEdit19.Text:=s;
i:=5
end
else
i:=0
end
else
i:=0
end;
BS_UTF32Default..BS_UTF32LE:
begin
i:=UTF32BSToUTF16CUS(Pointer(TmpUTFBS),Length(TmpUTFBS),nil);
if i>0 then
begin
SetLength(s,i);
if UTF32BSToUTF16CUS(Pointer(TmpUTFBS),Length(TmpUTFBS),Pointer(s))
=i
then
begin
TntRichEdit19.Text:=s;
i:=6
end
else
i:=0
end
else
i:=0
end
else
i:=0
end;
DispBSCommonProc_14(i)
end;
procedure TForm1.TntButton52Click(Sender: TObject);
var
i:integer;
s:WideString;
begin
i:=Length(TmpUTFBS);
s:='在未知编码格式字节序列中检测到了'+inttostr(GuessUTF8BSAvaiByteCount(
Pointer(TmpUTFBS),@i))+'个符合UTF-8编码机制规范的字节,总共检测了序列中的'+
inttostr(i)+'个字节';
MessageBoxW(Form1.Handle,Pointer(s),'试练GuessUTF8BSAvaiByteCount函数',
mb_ok)
end;
procedure TForm1.TntButton53Click(Sender: TObject);
var
i:integer;
s:WideString;
begin
i:=Length(TmpUTFBS);
s:='在未知编码格式字节序列中检测到了'+inttostr(GuessUTF16BSAvaiByteCount(
Pointer(TmpUTFBS),@i))+'个符合UTF-16编码机制规范的字节,总共检测了序列中的'+
inttostr(i)+'个字节';
MessageBoxW(Form1.Handle,Pointer(s),'试练GuessUTF16BSAvaiByteCount函数',
mb_ok)
end;
procedure TForm1.TntButton54Click(Sender: TObject);
var
i:integer;
s:WideString;
begin
i:=Length(TmpUTFBS);
s:='在未知编码格式字节序列中检测到了'+inttostr(GuessUTF32BSAvaiByteCount(
Pointer(TmpUTFBS),@i))+'个符合UTF-32编码机制规范的字节,总共检测了序列中的'+
inttostr(i)+'个字节';
MessageBoxW(Form1.Handle,Pointer(s),'试练GuessUTF32BSAvaiByteCount函数',
mb_ok)
end;
procedure TForm1.TntButton55Click(Sender: TObject);
begin
if BOMTypeOfUTF8BS(Pointer(TmpUTFBS))=0 then
MessageBoxW(Form1.Handle,'这个UTF-8编码格式字节序列不带有BOM头','试练'+
'BOMTypeOfUTF8BS函数',mb_ok)
else
MessageBoxW(Form1.Handle,'这个UTF-8编码格式字节序列带有BOM头','试练'+
'BOMTypeOfUTF8BS函数',mb_ok)
end;
procedure TForm1.TntButton56Click(Sender: TObject);
var
s:WideString;
begin
s:='这个UTF-16编码格式字节序列';
case TBOM(BOMTypeOfUTF16BS(Pointer(TmpUTFBS),Length(TmpUTFBS))) of
BOMDefault:
s:=s+'不带有BOM头';
BOMBE:
s:=s+'带有大尾字节序BOM';
BOMLE:
s:=s+'带有小尾字节序BOM'
end;
MessageBoxW(Form1.Handle,Pointer(s),'试练BOMTypeOfUTF16BS函数',mb_ok)
end;
procedure TForm1.TntButton57Click(Sender: TObject);
var
s:WideString;
begin
s:='这个UTF-32编码格式字节序列';
case TBOM(BOMTypeOfUTF32BS(Pointer(TmpUTFBS),Length(TmpUTFBS))) of
BOMDefault:
s:=s+'不带有BOM头';
BOMBE:
s:=s+'带有大尾字节序BOM';
BOMLE:
s:=s+'带有小尾字节序BOM'
end;
MessageBoxW(Form1.Handle,Pointer(s),'试练BOMTypeOfUTF32BS函数',mb_ok)
end;
procedure TForm1.TntButton58Click(Sender: TObject);
var
s:WideString;
i:integer;
begin
s:='这是一个';
i:=Length(TmpUTFBS);
case TBSType(GuessBSType(Pointer(TmpUTFBS),@i,80)) of
BS_Unknow:
s:=s+'未知类型';
BS_UTF8WithoutBOM:
s:=s+'不带BOM头的UTF-8';
BS_UTF8WithBOM:
s:=s+'带BOM头的UTF-8';
BS_UTF16Default:
s:=s+'默认字节序的UTF-16';
BS_UTF16BE:
s:=s+'大尾字节序的UTF-16';
BS_UTF16LE:
s:=s+'小尾字节序的UTF-16';
BS_UTF32Default:
s:=s+'默认字节序的UTF-32';
BS_UTF32BE:
s:=s+'大尾字节序的UTF-32';
BS_UTF32LE:
s:=s+'小尾字节序的UTF-32'
end;
s:=s+'编码格式字节序列';
MessageBoxW(Form1.Handle,Pointer(s),'试练GuessBSType函数',mb_ok)
end;
procedure TForm1.TntTabSheet15Show(Sender: TObject);
begin
TntRichEdit21.OnChange(TntRichEdit21);
TntRichEdit21.OnSelectionChange(TntRichEdit21);
TntRichEdit21.SetFocus;
TntRichEdit21.Tag:=0
end;
procedure TForm1.TntRichEdit21Change(Sender: TObject);
var
i:integer;
s:WideString;
begin
i:=Length(TmpUTFBS);
case TBSType(GuessBSType(Pointer(TmpUTFBS),@i,80)) of
BS_UTF8WithoutBOM,BS_UTF8WithBOM:
begin
i:=UTF8BSToUTF16CUS(Pointer(TmpUTFBS),nil);
if i>0 then
begin
SetLength(s,i);
if UTF8BSToUTF16CUS(Pointer(TmpUTFBS),Pointer(s))=i then
begin
TntRichEdit21.Text:=s;
TmpUTF8Str:=TmpUTFBS;
i:=4
end
else
i:=0
end
else
i:=0
end;
BS_UTF16Default..BS_UTF16LE:
begin
i:=BSToCUSForUTF16(Pointer(TmpUTFBS),Length(TmpUTFBS),nil);
if i>0 then
begin
SetLength(s,i);
if BSToCUSForUTF16(Pointer(TmpUTFBS),Length(TmpUTFBS),Pointer(s))=i then
begin
TntRichEdit21.Text:=s;
i:=5
end
else
i:=0
end
else
i:=0
end;
BS_UTF32Default..BS_UTF32LE:
begin
i:=UTF32BSToUTF16CUS(Pointer(TmpUTFBS),Length(TmpUTFBS),nil);
if i>0 then
begin
SetLength(s,i);
if UTF32BSToUTF16CUS(Pointer(TmpUTFBS),Length(TmpUTFBS),Pointer(s))
=i
then
begin
TntRichEdit21.Text:=s;
i:=6
end
else
i:=0
end
else
i:=0
end
else
i:=0
end;
DispBSCommonProc_15(i)
end;
procedure TForm1.TntRichEdit21SelectionChange(Sender: TObject);
label 10;
var
i,j,charsize:integer;
begin
if TntRichEdit21.ReadOnly then
if TntRichEdit21.Tag=0 then
begin
TntRichEdit21.Tag:=1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit21.Text),
TntRichEdit21.SelStart+1))=BMPCP
then
TntRichEdit21.SelLength:=1
else
TntRichEdit21.SelLength:=2;
if TntRichEdit22.Tag<>1 then
begin
TntGroupBox14.Tag:=TntRichEdit22.Tag;
TntRichEdit22.Tag:=1;
case TntGroupBox14.Tag of
0:
begin
TntRichEdit22.SelStart:=TntRichEdit21.SelStart*5;
if TntRichEdit21.SelLength=1 then
TntRichEdit22.SelLength:=4
else
TntRichEdit22.SelLength:=9
end;
2:
begin
TntButton25.Tag:=0;
10:
i:=UTF16CUToCharIndex(Pointer(TntRichEdit21.Text),
TntRichEdit21.SelStart+1,true);
i:=UTF8CharToCUIndex(Pointer(TmpUTF8Str),i,true);
UTF8CUIndexOfChar(Pointer(TmpUTF8Str),i,@j,@charsize);
i:=i+BOMSizeOfUTF8*TntButton25.Tag;
TntRichEdit22.SelStart:=(i-1)*3;
TntRichEdit22.SelLength:=(charsize-1)*3+2
end;
3:
begin
i:=TntRichEdit21.SelStart+1;
i:=UTF16CUToCharIndex(Pointer(TntRichEdit21.Text),i,true);
TntRichEdit22.SelStart:=(i-1)*9;
TntRichEdit22.SelLength:=8
end;
4:
begin
TntButton25.Tag:=BOMTypeOfUTF8BS(Pointer(TmpUTFBS));
goto 10
end;
5:
begin
TntButton27.Tag:=BOMTypeOfUTF16BS(Pointer(TmpUTFBS),Length(
TmpUTFBS));
if TntButton27.Tag>0 then
i:=TntRichEdit21.SelStart+1
else
i:=TntRichEdit21.SelStart;
TntRichEdit22.SelStart:=i*2*3;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit21.Text),
TntRichEdit21.SelStart+1))=BMPCP
then
TntRichEdit22.SelLength:=5
else
TntRichEdit22.SelLength:=11
end;
6:
begin
TntButton29.Tag:=BOMTypeOfUTF32BS(Pointer(TmpUTFBS),Length(
TmpUTFBS));
i:=UTF16CUToCharIndex(Pointer(TntRichEdit21.Text),
TntRichEdit21.SelStart+1,true)-1;
if TntButton29.Tag>0 then
inc(i);
TntRichEdit22.SelStart:=i*4*3;
TntRichEdit22.SelLength:=11
end
end
end
end
else
if TntRichEdit21.SelLength>0 then
TntRichEdit21.Tag:=0
end;
procedure TForm1.TntRichEdit22SelectionChange(Sender: TObject);
label 10;
var
i,j:integer;
begin
if TntRichEdit22.Tag<>1 then
TntGroupBox14.Tag:=TntRichEdit22.Tag;
case TntRichEdit22.Tag of
0:
begin
i:=TntRichEdit22.SelStart div 5 + 1;
TntRichEdit22.Tag:=1;
TntRichEdit22.SelStart:=(i-1)*5;
TntRichEdit22.SelLength:=4;
j:=UTF16CUIndexOfChar(Pointer(TntRichEdit21.Text),i,@j);
TntRichEdit21.Tag:=1;
TntRichEdit21.SelStart:=i-j;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit21.Text),i))=BMPCP then
TntRichEdit21.SelLength:=1
else
TntRichEdit21.SelLength:=2
end;
2:
begin
TntButton25.Tag:=0;
10:
i:=TntRichEdit22.SelStart div 3 + 1;
TntRichEdit22.Tag:=1;
TntRichEdit22.SelStart:=(i-1)*3;
TntRichEdit22.SelLength:=2;
if (TntButton25.Tag=1) and (i<=BOMSizeOfUTF8) then
begin
TntRichEdit21.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-8编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit21.HideSelection:=false;
i:=i-BOMSizeOfUTF8*TntButton25.Tag;
if not TntRichEdit21.HideSelection then
begin
i:=UTF8CUToCharIndex(Pointer(TmpUTF8Str),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit21.Text),i,true);
TntRichEdit21.Tag:=1;
TntRichEdit21.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit21.Text),i))=BMPCP then
TntRichEdit21.SelLength:=1
else
TntRichEdit21.SelLength:=2
end
end;
3:
begin
i:=TntRichEdit22.SelStart div 9 + 1;
TntRichEdit22.Tag:=1;
TntRichEdit22.SelStart:=(i-1)*9;
TntRichEdit22.SelLength:=8;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit21.Text),i,true);
TntRichEdit21.Tag:=1;
TntRichEdit21.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit21.Text),i))=BMPCP then
TntRichEdit21.SelLength:=1
else
TntRichEdit21.SelLength:=2
end;
4:
begin
TntButton25.Tag:=BOMTypeOfUTF8BS(Pointer(TmpUTFBS));
goto 10
end;
5:
begin
TntButton27.Tag:=BOMTypeOfUTF16BS(Pointer(TmpUTFBS),Length(TmpUTFBS));
i:=TntRichEdit22.SelStart div 3 + 1;
TntRichEdit22.Tag:=1;
TntRichEdit22.SelStart:=(i-1)*3;
TntRichEdit22.SelLength:=2;
if TntButton27.Tag>0 then
begin
if i<=BOMSizeOfUTF16 then
begin
TntRichEdit21.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-16编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit21.HideSelection:=false;
i:=i-BOMSizeOfUTF16
end
else
TntRichEdit21.HideSelection:=false;
if not TntRichEdit21.HideSelection then
begin
i:=(i-1) div 2 + 1;
i:=UTF16CUToCharIndex(Pointer(TntRichEdit21.Text),i,true);
i:=UTF16CharToCUIndex(Pointer(TntRichEdit21.Text),i,true);
TntRichEdit21.Tag:=1;
TntRichEdit21.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit21.Text),i))=BMPCP then
TntRichEdit21.SelLength:=1
else
TntRichEdit21.SelLength:=2
end
end;
6:
begin
TntButton29.Tag:=BOMTypeOfUTF32BS(Pointer(TmpUTFBS),Length(TmpUTFBS));
i:=TntRichEdit22.SelStart div 3 + 1;
TntRichEdit22.Tag:=1;
TntRichEdit22.SelStart:=(i-1)*3;
TntRichEdit22.SelLength:=2;
if TntButton29.Tag>0 then
begin
if i<=BOMSizeOfUTF32 then
begin
TntRichEdit21.HideSelection:=true;
MessageBoxW(Form1.Handle,'你点中的是属于UTF-32编码格式字节序列BOM的字节',
'点击非字符编码字节提示',mb_ok)
end
else
TntRichEdit21.HideSelection:=false;
i:=i-BOMSizeOfUTF32
end
else
TntRichEdit21.HideSelection:=false;
if not TntRichEdit21.HideSelection then
begin
i:=(i-1) div 4 + 1;
i:=UTF16CharToCUIndex(Pointer(TntRichEdit21.Text),i,true);
TntRichEdit21.Tag:=1;
TntRichEdit21.SelStart:=i-1;
if TUTF16CUT(UTF16CodeUnitType(Pointer(TntRichEdit21.Text),i))=BMPCP then
TntRichEdit21.SelLength:=1
else
TntRichEdit21.SelLength:=2
end
end;
1:
if TntRichEdit22.SelLength>0 then
TntRichEdit22.Tag:=TntGroupBox14.Tag
end;
TntRichEdit21.Tag:=0
end;
procedure TForm1.TntButton59Click(Sender: TObject);
begin
if TntSaveDialog1.Execute then
if SaveUniByteSequToFile(Pointer(TmpUTFBS),Length(TmpUTFBS),Pointer(
TntSaveDialog1.FileName))
then
MessageBoxW(Form1.Handle,'已经成功把这个字节序列保存为文本文件了','试练'+
'SaveUniByteSequToFile函数',mb_ok)
end;
procedure TForm1.TntButton60Click(Sender: TObject);
var
i,j,k:integer;
s:WideString;
begin
if TntOpenDialog1.Execute then
begin
i:=0;
i:=LoadUniByteSequFromFile(Pointer(TntOpenDialog1.FileName),@i,nil,@j);
if i>0 then
begin
SetLength(TmpUTFBS,i);
if LoadUniByteSequFromFile(nil,nil,Pointer(TmpUTFBS),nil)=i then
TntRichEdit21.OnChange(TntRichEdit21)
end
end
end;
end.
/////////////////////////////////Unit1.dfm////////////////////////////////
object Form1: TForm1
Left = 192
Top = 114
ActiveControl = TntPageControl5
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'UCS'#29790#22763#20891#20992#28436#27494#22530
ClientHeight = 446
ClientWidth = 688
Color = clBtnFace
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = #26032#23435#20307
Font.Style = []
OldCreateOrder = False
Position = poDesktopCenter
ShowHint = True
OnCreate = TntFormCreate
OnShow = TntFormShow
PixelsPerInch = 96
TextHeight = 12
object TntPageControl1: TTntPageControl
Left = 0
Top = 0
Width = 688
Height = 446
ActivePage = TntTabSheet4
Align = alClient
TabOrder = 0
object TntTabSheet1: TTntTabSheet
Caption = 'Unicode'#32534#30721#26684#24335#22788#29702
OnShow = TntTabSheet1Show
object TntPageControl2: TTntPageControl
Left = 0
Top = 0
Width = 680
Height = 419
ActivePage = TntTabSheet5
Align = alClient
TabOrder = 0
TabPosition = tpBottom
object TntTabSheet5: TTntTabSheet
Caption = 'UTF-16'#32534#30721#26684#24335#22788#29702#20363#31243
OnShow = TntTabSheet5Show
object TntRichEdit1: TTntRichEdit
Left = 0
Top = 0
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
WantTabs = True
OnChange = TntRichEdit1Change
OnDblClick = TntRichEdit1DblClick
OnSelectionChange = TntRichEdit1SelectionChange
end
object TntGroupBox1: TTntGroupBox
Left = 404
Top = 0
Width = 265
Height = 89
Caption = 'UTF16CodeUnitType'#20989#25968
TabOrder = 1
object TntRadioButton1: TTntRadioButton
Left = 10
Top = 24
Width = 113
Height = 17
Caption = #25351#23450#32534#30721#21333#20803#20301#32622
TabOrder = 0
OnClick = TntRadioButton1Click
end
object TntRadioButton2: TTntRadioButton
Left = 138
Top = 24
Width = 113
Height = 17
Caption = #24403#21069#32534#30721#21333#20803#20301#32622
Checked = True
TabOrder = 1
TabStop = True
OnClick = TntRadioButton2Click
end
object TntButton1: TTntButton
Left = 138
Top = 53
Width = 75
Height = 25
Hint = #21028#26029'UTF-16'#32534#30721#26684#24335#23383#31526#20018#20013#25351#23450#20301#32622#19978#37027#20010#32534#30721#21333#20803#30340#31867#22411
Caption = #35797#32451
TabOrder = 3
OnClick = TntButton1Click
end
object Edit1: TEdit
Left = 10
Top = 53
Width = 121
Height = 20
TabOrder = 2
OnChange = Edit1Change
OnEnter = Edit1Enter
OnKeyPress = Edit1KeyPress
end
end
object TntGroupBox2: TTntGroupBox
Left = 404
Top = 100
Width = 265
Height = 89
Caption = 'UTF16CUToCharIndex'#20989#25968
TabOrder = 2
object TntRadioButton3: TTntRadioButton
Left = 10
Top = 24
Width = 113
Height = 17
Caption = #25351#23450#32534#30721#21333#20803#20301#32622
TabOrder = 0
OnClick = TntRadioButton3Click
end
object TntRadioButton4: TTntRadioButton
Left = 138
Top = 24
Width = 113
Height = 17
Caption = #24403#21069#32534#30721#21333#20803#20301#32622
Checked = True
TabOrder = 1
TabStop = True
OnClick = TntRadioButton4Click
end
object TntButton2: TTntButton
Left = 138
Top = 53
Width = 75
Height = 25
Hint = #35745#31639'UTF-16'#23383#31526#20018#20013#25351#23450#20301#32622#19978#37027#20010#32534#30721#21333#20803#25152#23646#30340#23383#31526#26159#23383#31526#20018#20013#30340#31532#20960#20010#23383#31526
Caption = #35797#32451
TabOrder = 3
OnClick = TntButton2Click
end
object Edit2: TEdit
Left = 10
Top = 53
Width = 121
Height = 20
TabOrder = 2
OnChange = Edit1Change
OnEnter = Edit1Enter
OnKeyPress = Edit2KeyPress
end
end
object TntGroupBox3: TTntGroupBox
Left = 404
Top = 200
Width = 265
Height = 89
Caption = 'UTF16CharToCUIndex'#20989#25968
TabOrder = 3
object Edit3: TEdit
Left = 10
Top = 53
Width = 121
Height = 20
TabOrder = 0
OnChange = Edit1Change
OnEnter = Edit1Enter
OnKeyPress = Edit3KeyPress
end
object TntButton3: TTntButton
Left = 138
Top = 53
Width = 75
Height = 25
Hint = #35745#31639'UTF-16'#23383#31526#20018#20013#25351#23450#20301#32622#19978#37027#20010#23383#31526#30340#31532#19968#20010#32534#30721#21333#20803#26159#23383#31526#20018#20013#30340#31532#20960#20010#32534#30721#21333#20803
Caption = #35797#32451
TabOrder = 1
OnClick = TntButton3Click
end
object TntRadioButton15: TTntRadioButton
Left = 10
Top = 24
Width = 113
Height = 17
Caption = #25351#23450#23383#31526#20301#32622
TabOrder = 2
OnClick = TntRadioButton15Click
end
object TntRadioButton16: TTntRadioButton
Left = 138
Top = 24
Width = 113
Height = 17
Caption = #24403#21069#23383#31526#20301#32622
Checked = True
TabOrder = 3
TabStop = True
OnClick = TntRadioButton16Click
end
end
object TntGroupBox4: TTntGroupBox
Left = 0
Top = 269
Width = 186
Height = 55
Caption = 'CPToUTF16CUS'#20989#25968
TabOrder = 4
object Edit4: TEdit
Left = 10
Top = 18
Width = 80
Height = 20
CharCase = ecUpperCase
MaxLength = 8
TabOrder = 0
OnChange = Edit4Change
OnEnter = Edit1Enter
OnKeyPress = Edit4KeyPress
end
object TntButton4: TTntButton
Left = 95
Top = 18
Width = 75
Height = 25
Hint = #25226'Unicode'#32534#30721#28857#25968#23383#36716#25442#20026'UTF-16'#32534#30721#21333#20803#24207#21015
Caption = #35797#32451
Enabled = False
TabOrder = 1
OnClick = TntButton4Click
end
end
object TntGroupBox5: TTntGroupBox
Left = 404
Top = 300
Width = 265
Height = 89
Caption = 'UTF16CUSToCP'#20989#25968
TabOrder = 5
object TntRadioButton5: TTntRadioButton
Left = 10
Top = 24
Width = 113
Height = 17
Caption = #25351#23450#32534#30721#21333#20803#20301#32622
TabOrder = 0
OnClick = TntRadioButton5Click
end
object TntRadioButton6: TTntRadioButton
Left = 138
Top = 24
Width = 113
Height = 17
Caption = #24403#21069#32534#30721#21333#20803#20301#32622
Checked = True
TabOrder = 1
TabStop = True
OnClick = TntRadioButton6Click
end
object TntButton5: TTntButton
Left = 138
Top = 53
Width = 75
Height = 25
Hint = #25226'UTF-16'#32534#30721#21333#20803#24207#21015#36716#25442#20026'Unicode'#32534#30721#28857#25968#23383
Caption = #35797#32451
TabOrder = 3
OnClick = TntButton5Click
end
object Edit5: TEdit
Left = 10
Top = 53
Width = 121
Height = 20
TabOrder = 2
OnChange = Edit1Change
OnEnter = Edit1Enter
OnKeyPress = Edit5KeyPress
end
end
object TntGroupBox6: TTntGroupBox
Left = 0
Top = 334
Width = 186
Height = 55
Caption = 'CPToSurrPair'#20989#25968
TabOrder = 6
object Edit6: TEdit
Left = 10
Top = 18
Width = 80
Height = 20
CharCase = ecUpperCase
MaxLength = 8
TabOrder = 0
OnChange = Edit4Change
OnEnter = Edit1Enter
OnKeyPress = Edit6KeyPress
end
object TntButton6: TTntButton
Left = 95
Top = 18
Width = 75
Height = 25
Hint = #25226#22686#34917'Unicode'#32534#30721#28857#25968#23383#36716#25442#20026'UTF-16'#32534#30721#21333#20803#24207#21015
Caption = #35797#32451
Enabled = False
TabOrder = 1
OnClick = TntButton6Click
end
end
object TntGroupBox7: TTntGroupBox
Left = 196
Top = 269
Width = 117
Height = 120
Caption = 'SurrPairToCP'#20989#25968
TabOrder = 7
object Edit7: TEdit
Left = 10
Top = 18
Width = 40
Height = 20
CharCase = ecUpperCase
MaxLength = 4
TabOrder = 0
OnChange = Edit4Change
OnEnter = Edit1Enter
OnKeyPress = Edit7KeyPress
end
object TntButton7: TTntButton
Left = 10
Top = 83
Width = 75
Height = 25
Hint = #25226#25351#23450#30340#20195#29702#23545#36716#25442#20026#30456#24212#30340'Unicode'#32534#30721#28857#25968#23383
Caption = #35797#32451
Enabled = False
TabOrder = 2
OnClick = TntButton7Click
end
object Edit8: TEdit
Left = 10
Top = 42
Width = 40
Height = 20
CharCase = ecUpperCase
MaxLength = 4
TabOrder = 1
OnChange = Edit4Change
OnEnter = Edit1Enter
OnKeyPress = Edit7KeyPress
end
end
object TntRichEdit4: TTntRichEdit
Left = 0
Top = 133
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 8
WantTabs = True
OnSelectionChange = TntRichEdit4SelectionChange
end
end
object TntTabSheet6: TTntTabSheet
Caption = 'UTF-8'#32534#30721#26684#24335#22788#29702#20363#31243
OnShow = TntTabSheet6Show
object TntRichEdit2: TTntRichEdit
Left = 0
Top = 0
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
WantTabs = True
OnChange = TntRichEdit2Change
OnDblClick = TntRichEdit2DblClick
OnSelectionChange = TntRichEdit2SelectionChange
end
object TntRichEdit3: TTntRichEdit
Left = 0
Top = 133
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 1
WantTabs = True
OnSelectionChange = TntRichEdit3SelectionChange
end
object TntGroupBox8: TTntGroupBox
Left = 404
Top = 0
Width = 265
Height = 89
Caption = 'UTF8CUIndexOfChar'#20989#25968
TabOrder = 2
object TntRadioButton7: TTntRadioButton
Left = 10
Top = 24
Width = 113
Height = 17
Caption = #25351#23450#32534#30721#21333#20803#20301#32622
TabOrder = 0
OnClick = TntRadioButton7Click
end
object TntRadioButton8: TTntRadioButton
Left = 138
Top = 24
Width = 113
Height = 17
Caption = #24403#21069#32534#30721#21333#20803#20301#32622
Checked = True
TabOrder = 1
TabStop = True
OnClick = TntRadioButton8Click
end
object TntButton8: TTntButton
Left = 138
Top = 53
Width = 75
Height = 25
Hint = #22312#19968#20010'UTF-8 '#23383#31526#20018#20013#65292#21028#26029#25351#23450#20301#32622#19978#30340#32534#30721#21333#20803#26159#23427#25152#23646#30340#37027#20010#23383#31526#30340#31532#20960#20010#32534#30721#21333#20803
Caption = #35797#32451
TabOrder = 3
OnClick = TntButton8Click
end
object Edit9: TEdit
Left = 10
Top = 53
Width = 121
Height = 20
TabOrder = 2
OnChange = Edit1Change
OnEnter = Edit1Enter
OnKeyPress = Edit9KeyPress
end
end
object TntGroupBox9: TTntGroupBox
Left = 404
Top = 92
Width = 265
Height = 89
Caption = 'UTF8CUToCharIndex'#20989#25968
TabOrder = 3
object TntRadioButton9: TTntRadioButton
Left = 10
Top = 24
Width = 113
Height = 17
Caption = #25351#23450#32534#30721#21333#20803#20301#32622
TabOrder = 0
OnClick = TntRadioButton9Click
end
object TntRadioButton10: TTntRadioButton
Left = 138
Top = 24
Width = 113
Height = 17
Caption = #24403#21069#32534#30721#21333#20803#20301#32622
Checked = True
TabOrder = 1
TabStop = True
OnClick = TntRadioButton10Click
end
object TntButton9: TTntButton
Left = 138
Top = 53
Width = 75
Height = 25
Hint = #22312#19968#20010'UTF-8 '#23383#31526#20018#20013#65292#21028#26029#25351#23450#20301#32622#19978#30340#32534#30721#21333#20803#25152#23646#30340#37027#20010#23383#31526#26159#23383#31526#20018#20013#30340#31532#20960#20010#23383#31526
Caption = #35797#32451
TabOrder = 3
OnClick = TntButton9Click
end
object Edit10: TEdit
Left = 10
Top = 53
Width = 121
Height = 20
TabOrder = 2
OnChange = Edit1Change
OnEnter = Edit1Enter
OnKeyPress = Edit10KeyPress
end
end
object TntGroupBox10: TTntGroupBox
Left = 404
Top = 184
Width = 265
Height = 89
Caption = 'UTF8CharToCUIndex'#20989#25968
TabOrder = 4
object TntRadioButton11: TTntRadioButton
Left = 10
Top = 24
Width = 113
Height = 17
Caption = #25351#23450#23383#31526#20301#32622
TabOrder = 0
OnClick = TntRadioButton11Click
end
object TntRadioButton12: TTntRadioButton
Left = 138
Top = 24
Width = 113
Height = 17
Caption = #24403#21069#23383#31526#20301#32622
Checked = True
TabOrder = 1
TabStop = True
OnClick = TntRadioButton12Click
end
object TntButton10: TTntButton
Left = 138
Top = 53
Width = 75
Height = 25
Hint = #22312#19968#20010'UTF-8 '#23383#31526#20018#20013#65292#21028#26029#25351#23450#20301#32622#19978#30340#23383#31526#30340#31532#19968#20010#32534#30721#21333#20803#26159#23383#31526#20018#20013#30340#31532#20960#20010#32534#30721#21333#20803
Caption = #35797#32451
TabOrder = 3
OnClick = TntButton10Click
end
object Edit11: TEdit
Left = 10
Top = 53
Width = 121
Height = 20
TabOrder = 2
OnChange = Edit1Change
OnEnter = Edit1Enter
OnKeyPress = Edit11KeyPress
end
end
object TntGroupBox11: TTntGroupBox
Left = 404
Top = 277
Width = 186
Height = 55
Caption = 'CPToUTF8CUS'#20989#25968
TabOrder = 5
object Edit12: TEdit
Left = 10
Top = 18
Width = 80
Height = 20
CharCase = ecUpperCase
MaxLength = 8
TabOrder = 0
OnChange = Edit4Change
OnEnter = Edit1Enter
OnKeyPress = Edit12KeyPress
end
object TntButton11: TTntButton
Left = 95
Top = 18
Width = 75
Height = 25
Hint = #25226#25351#23450#30340'Unicode'#32534#30721#28857#25968#23383#36716#25442#20026#30456#24212#30340'UTF-8'#32534#30721#21333#20803#24207#21015
Caption = #35797#32451
Enabled = False
TabOrder = 1
OnClick = TntButton11Click
end
end
object TntGroupBox12: TTntGroupBox
Left = 404
Top = 334
Width = 186
Height = 55
Caption = 'GetCPPartIndexOfUTF8'#20989#25968
TabOrder = 6
object Edit13: TEdit
Left = 10
Top = 18
Width = 80
Height = 20
CharCase = ecUpperCase
MaxLength = 8
TabOrder = 0
OnChange = Edit4Change
OnEnter = Edit1Enter
OnKeyPress = Edit13KeyPress
end
object TntButton12: TTntButton
Left = 95
Top = 18
Width = 75
Height = 25
Hint = #21028#26029#19968#20010#25351#23450#30340'Unicode'#32534#30721#28857#25968#23383#23646#20110'UTF-8'#32534#30721#28857#20998#27573#30340#21738#19968#27573
Caption = #35797#32451
Enabled = False
TabOrder = 1
OnClick = TntButton12Click
end
end
object TntGroupBox13: TTntGroupBox
Left = 134
Top = 300
Width = 265
Height = 89
Caption = 'UTF8CUSToCP'#20989#25968
TabOrder = 7
object TntRadioButton13: TTntRadioButton
Left = 10
Top = 24
Width = 113
Height = 17
Caption = #25351#23450#32534#30721#21333#20803#20301#32622
TabOrder = 0
OnClick = TntRadioButton13Click
end
object TntRadioButton14: TTntRadioButton
Left = 138
Top = 24
Width = 113
Height = 17
Caption = #24403#21069#32534#30721#21333#20803#20301#32622
Checked = True
TabOrder = 1
TabStop = True
OnClick = TntRadioButton14Click
end
object TntButton13: TTntButton
Left = 138
Top = 53
Width = 75
Height = 25
Hint = #25226'UTF-8'#32534#30721#21333#20803#24207#21015#36716#25442#20026'Unicode'#32534#30721#28857#25968#23383
Caption = #35797#32451
TabOrder = 3
OnClick = TntButton13Click
end
object Edit14: TEdit
Left = 10
Top = 53
Width = 121
Height = 20
TabOrder = 2
OnChange = Edit1Change
OnEnter = Edit1Enter
OnKeyPress = Edit14KeyPress
end
end
end
object TntTabSheet7: TTntTabSheet
Caption = #32534#30721#26684#24335#32508#21512#22788#29702
OnShow = TntTabSheet7Show
object TntRichEdit5: TTntRichEdit
Left = 0
Top = 0
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
WantTabs = True
OnChange = TntRichEdit5Change
OnDblClick = TntRichEdit5DblClick
OnSelectionChange = TntRichEdit5SelectionChange
end
object TntRichEdit6: TTntRichEdit
Left = 0
Top = 133
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 1
WantTabs = True
OnSelectionChange = TntRichEdit6SelectionChange
end
object TntGroupBox14: TTntGroupBox
Left = 404
Top = 0
Width = 265
Height = 89
TabOrder = 2
object TntRadioButton17: TTntRadioButton
Left = 10
Top = 24
Width = 113
Height = 17
Caption = #25351#23450#32534#30721#21333#20803#20301#32622
TabOrder = 0
OnClick = TntRadioButton17Click
end
object TntRadioButton18: TTntRadioButton
Left = 138
Top = 24
Width = 113
Height = 17
Caption = #24403#21069#32534#30721#21333#20803#20301#32622
Checked = True
TabOrder = 1
TabStop = True
OnClick = TntRadioButton18Click
end
object TntButton14: TTntButton
Left = 138
Top = 53
Width = 75
Height = 25
Hint = #22312#19968#20010'UTF-16'#23383#31526#20018#20013#65292#25226#25351#23450#20301#32622#19978#37027#20010#32534#30721#21333#20803#25152#23646#30340#23383#31526#30340#32534#30721#21333#20803#24207#21015#36716#25442#25104'UTF-8 '#32534#30721#21333#20803#24207#21015
Caption = #35797#32451
TabOrder = 3
OnClick = TntButton14Click
end
object Edit15: TEdit
Left = 10
Top = 53
Width = 121
Height = 20
TabOrder = 2
OnChange = Edit1Change
OnEnter = Edit1Enter
OnKeyPress = Edit15KeyPress
end
end
object TntRadioButton19: TTntRadioButton
Left = 410
Top = 0
Width = 153
Height = 17
Caption = 'UTF16ToUTF8ForChar'#20989#25968
Checked = True
TabOrder = 3
TabStop = True
OnClick = TntRadioButton19Click
end
object TntGroupBox15: TTntGroupBox
Left = 404
Top = 92
Width = 265
Height = 89
TabOrder = 4
object TntRadioButton20: TTntRadioButton
Left = 10
Top = 24
Width = 113
Height = 17
Caption = #25351#23450#32534#30721#21333#20803#20301#32622
TabOrder = 0
OnClick = TntRadioButton20Click
end
object TntRadioButton21: TTntRadioButton
Left = 138
Top = 24
Width = 113
Height = 17
Caption = #24403#21069#32534#30721#21333#20803#20301#32622
Checked = True
TabOrder = 1
TabStop = True
OnClick = TntRadioButton21Click
end
object TntButton15: TTntButton
Left = 138
Top = 53
Width = 75
Height = 25
Hint = #22312#19968#20010'UTF-8'#23383#31526#20018#20013#65292#25226#25351#23450#20301#32622#19978#30340#32534#30721#21333#20803#25152#23646#30340#37027#20010#23383#31526#30340#32534#30721#21333#20803#24207#21015#36716#25442#20026'UTF-16'#32534#30721#21333#20803#24207#21015
Caption = #35797#32451
TabOrder = 3
OnClick = TntButton15Click
end
object Edit16: TEdit
Left = 10
Top = 53
Width = 121
Height = 20
TabOrder = 2
OnChange = Edit1Change
OnEnter = Edit1Enter
OnKeyPress = Edit16KeyPress
end
end
object TntRadioButton22: TTntRadioButton
Left = 410
Top = 91
Width = 153
Height = 17
Caption = 'UTF8ToUTF16ForChar'#20989#25968
TabOrder = 5
OnClick = TntRadioButton19Click
end
object TntGroupBox16: TTntGroupBox
Left = 404
Top = 184
Width = 265
Height = 65
TabOrder = 6
object TntButton16: TTntButton
Left = 138
Top = 24
Width = 75
Height = 25
Hint = #25226'UTF-16'#23383#31526#20018#36716#25442#20026'UTF-8'#23383#31526#20018
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton16Click
end
end
object TntRadioButton23: TTntRadioButton
Left = 410
Top = 184
Width = 147
Height = 17
Caption = 'UTF16ToUTF8ForStr'#20989#25968
TabOrder = 7
OnClick = TntRadioButton19Click
end
object TntGroupBox17: TTntGroupBox
Left = 404
Top = 265
Width = 265
Height = 60
TabOrder = 8
object TntButton17: TTntButton
Left = 138
Top = 24
Width = 75
Height = 25
Hint = #25226'UTF-8'#23383#31526#20018#36716#25442#20026'UTF-16'#23383#31526#20018
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton17Click
end
end
object TntRadioButton24: TTntRadioButton
Left = 410
Top = 267
Width = 147
Height = 17
Caption = 'UTF8ToUTF16ForStr'#20989#25968
TabOrder = 9
OnClick = TntRadioButton19Click
end
object TntGroupBox18: TTntGroupBox
Left = 404
Top = 329
Width = 265
Height = 60
TabOrder = 10
object TntButton18: TTntButton
Left = 138
Top = 24
Width = 75
Height = 25
Hint = #25226'UTF-16'#23383#31526#20018#36716#25442#20026'UTF-32'#23383#31526#20018
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton18Click
end
end
object TntRadioButton25: TTntRadioButton
Left = 410
Top = 329
Width = 153
Height = 17
Caption = 'UTF16ToUTF32ForStr'#20989#25968
TabOrder = 11
OnClick = TntRadioButton19Click
end
object TntGroupBox19: TTntGroupBox
Left = 203
Top = 265
Width = 196
Height = 60
TabOrder = 12
object TntButton19: TTntButton
Left = 100
Top = 24
Width = 75
Height = 25
Hint = #25226'UTF-32'#23383#31526#20018#36716#25442#20026'UTF-16'#23383#31526#20018
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton19Click
end
end
object TntGroupBox20: TTntGroupBox
Left = 203
Top = 329
Width = 196
Height = 60
TabOrder = 13
object TntButton20: TTntButton
Left = 100
Top = 24
Width = 75
Height = 25
Hint = #25226'UTF-8'#23383#31526#20018#36716#25442#20026'UTF-32'#23383#31526#20018
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton20Click
end
end
object TntRadioButton26: TTntRadioButton
Left = 209
Top = 267
Width = 153
Height = 17
Caption = 'UTF32ToUTF16ForStr'#20989#25968
TabOrder = 14
OnClick = TntRadioButton19Click
end
object TntRadioButton27: TTntRadioButton
Left = 209
Top = 329
Width = 148
Height = 17
Caption = 'UTF8ToUTF32ForStr'#20989#25968
TabOrder = 15
OnClick = TntRadioButton19Click
end
object TntGroupBox21: TTntGroupBox
Left = 0
Top = 265
Width = 196
Height = 60
TabOrder = 16
object TntButton21: TTntButton
Left = 100
Top = 24
Width = 75
Height = 25
Hint = #25226'UTF-32'#23383#31526#20018#36716#25442#20026'UTF-8'#23383#31526#20018
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton21Click
end
end
object TntRadioButton28: TTntRadioButton
Left = 6
Top = 267
Width = 147
Height = 17
Caption = 'UTF32ToUTF8ForStr'#20989#25968
TabOrder = 17
OnClick = TntRadioButton19Click
end
end
object TntTabSheet8: TTntTabSheet
Caption = #36741#21161#27169#22359
OnShow = TntTabSheet8Show
object TntRichEdit7: TTntRichEdit
Left = 0
Top = 0
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
WantTabs = True
OnChange = TntRichEdit7Change
OnDblClick = TntRichEdit7DblClick
OnSelectionChange = TntRichEdit7SelectionChange
end
object TntRichEdit8: TTntRichEdit
Left = 0
Top = 133
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 1
WantTabs = True
OnSelectionChange = TntRichEdit8SelectionChange
end
object TntGroupBox22: TTntGroupBox
Left = 404
Top = 0
Width = 265
Height = 65
TabOrder = 2
object TntButton22: TTntButton
Left = 138
Top = 24
Width = 75
Height = 25
Hint = #35745#31639'UTF-16'#23383#31526#20018#20013#30340#23383#31526#25968#30446
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton22Click
end
end
object TntRadioButton29: TTntRadioButton
Left = 410
Top = 0
Width = 159
Height = 17
Caption = 'CharCountOfUTF16Str'#20989#25968
Checked = True
TabOrder = 3
TabStop = True
OnClick = TntRadioButton29Click
end
object TntGroupBox23: TTntGroupBox
Left = 404
Top = 69
Width = 265
Height = 60
TabOrder = 4
object TntButton23: TTntButton
Left = 138
Top = 24
Width = 75
Height = 25
Hint = #35745#31639'UTF-8'#23383#31526#20018#20013#30340#23383#31526#25968#30446
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton23Click
end
end
object TntRadioButton30: TTntRadioButton
Left = 410
Top = 69
Width = 154
Height = 17
Caption = 'CharCountOfUTF8Str'#20989#25968
TabOrder = 5
OnClick = TntRadioButton29Click
end
object TntGroupBox24: TTntGroupBox
Left = 404
Top = 133
Width = 265
Height = 60
TabOrder = 6
object TntButton24: TTntButton
Left = 138
Top = 24
Width = 75
Height = 25
Hint = #35745#31639'UTF-32'#23383#31526#20018#20013#30340#23383#31526#25968#30446
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton24Click
end
end
object TntRadioButton31: TTntRadioButton
Left = 410
Top = 133
Width = 160
Height = 17
Caption = 'CharCountOfUTF32Str'#20989#25968
TabOrder = 7
OnClick = TntRadioButton29Click
end
end
end
end
object TntTabSheet2: TTntTabSheet
Caption = 'Unicode'#32534#30721#26426#21046#22788#29702
OnShow = TntTabSheet1Show
object TntPageControl3: TTntPageControl
Left = 0
Top = 0
Width = 680
Height = 419
ActivePage = TntTabSheet9
Align = alClient
TabOrder = 0
TabPosition = tpBottom
object TntTabSheet9: TTntTabSheet
Caption = #30456#21516'UTF'#30340#32534#30721#26684#24335#21644#32534#30721#26426#21046#20043#38388#30340#36716#25442
OnShow = TntTabSheet9Show
object TntRichEdit9: TTntRichEdit
Left = 0
Top = 0
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
WantTabs = True
OnChange = TntRichEdit9Change
OnDblClick = TntRichEdit9DblClick
OnSelectionChange = TntRichEdit9SelectionChange
end
object TntRichEdit10: TTntRichEdit
Left = 0
Top = 133
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 1
WantTabs = True
OnSelectionChange = TntRichEdit10SelectionChange
end
object TntGroupBox25: TTntGroupBox
Left = 404
Top = 0
Width = 265
Height = 54
TabOrder = 2
object TntButton25: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-8'#32534#30721#21333#20803#24207#21015#36716#25442#20026#24102'BOM'#30340'UTF-8'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton25Click
end
object TntComboBox1: TTntComboBox
Left = 10
Top = 21
Width = 165
Height = 20
Style = csDropDownList
ItemHeight = 12
ItemIndex = 0
TabOrder = 1
Text = #19981#24102'BOM'
Items.Strings = (
#19981#24102'BOM'
#24102'BOM')
end
end
object TntRadioButton32: TTntRadioButton
Left = 410
Top = 0
Width = 129
Height = 17
Caption = 'CUSToBSForUTF8'#20989#25968
Checked = True
TabOrder = 3
TabStop = True
OnClick = TntRadioButton32Click
end
object TntGroupBox26: TTntGroupBox
Left = 404
Top = 66
Width = 265
Height = 54
TabOrder = 4
object TntButton26: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-8'#32534#30721#26684#24335#23383#33410#24207#21015#36716#25442#20026'UTF-8'#32534#30721#21333#20803#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton26Click
end
end
object TntRadioButton33: TTntRadioButton
Left = 410
Top = 66
Width = 129
Height = 17
Caption = 'BSToCUSForUTF8'#20989#25968
TabOrder = 5
OnClick = TntRadioButton32Click
end
object TntGroupBox27: TTntGroupBox
Left = 404
Top = 132
Width = 265
Height = 54
TabOrder = 6
object TntButton27: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-16'#32534#30721#21333#20803#24207#21015#36716#20026'UTF-16'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton27Click
end
object TntComboBox2: TTntComboBox
Left = 10
Top = 21
Width = 165
Height = 20
Style = csDropDownList
ItemHeight = 12
ItemIndex = 0
TabOrder = 1
Text = #19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
Items.Strings = (
#19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
#24102'BOM'#30340#22823#23614#23383#33410#24207#24207#21015
#24102'BOM'#30340#23567#23614#23383#33410#24207#24207#21015)
end
end
object TntRadioButton34: TTntRadioButton
Left = 410
Top = 132
Width = 135
Height = 17
Caption = 'CUSToBSForUTF16'#20989#25968
TabOrder = 7
OnClick = TntRadioButton32Click
end
object TntGroupBox28: TTntGroupBox
Left = 404
Top = 200
Width = 265
Height = 54
TabOrder = 8
object TntButton28: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-16'#32534#30721#26684#24335#23383#33410#24207#21015#36716#20026'UTF-16'#32534#30721#21333#20803#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton28Click
end
end
object TntRadioButton35: TTntRadioButton
Left = 410
Top = 200
Width = 135
Height = 17
Caption = 'BSToCUSForUTF16'#20989#25968
TabOrder = 9
OnClick = TntRadioButton32Click
end
object TntGroupBox29: TTntGroupBox
Left = 404
Top = 268
Width = 265
Height = 54
TabOrder = 10
object TntButton29: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-32'#32534#30721#21333#20803#24207#21015#36716#20026'UTF-32'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton29Click
end
object TntComboBox3: TTntComboBox
Left = 10
Top = 21
Width = 165
Height = 20
Style = csDropDownList
ItemHeight = 12
ItemIndex = 0
TabOrder = 1
Text = #19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
Items.Strings = (
#19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
#24102'BOM'#30340#22823#23614#23383#33410#24207#24207#21015
#24102'BOM'#30340#23567#23614#23383#33410#24207#24207#21015)
end
end
object TntRadioButton36: TTntRadioButton
Left = 410
Top = 268
Width = 135
Height = 17
Caption = 'CUSToBSForUTF32'#20989#25968
TabOrder = 11
OnClick = TntRadioButton32Click
end
object TntGroupBox30: TTntGroupBox
Left = 404
Top = 335
Width = 265
Height = 54
TabOrder = 12
object TntButton30: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-32'#32534#30721#26684#24335#23383#33410#24207#21015#36716#20026'UTF-32'#32534#30721#21333#20803#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton30Click
end
end
object TntRadioButton37: TTntRadioButton
Left = 410
Top = 335
Width = 135
Height = 17
Caption = 'BSToCUSForUTF32'#20989#25968
TabOrder = 13
OnClick = TntRadioButton32Click
end
end
object TntTabSheet10: TTntTabSheet
Caption = #19981#21516#32534#30721#26426#21046#20043#38388#30340#36716#25442
OnShow = TntTabSheet10Show
object TntRichEdit11: TTntRichEdit
Left = 0
Top = 0
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
WantTabs = True
OnChange = TntRichEdit11Change
OnDblClick = TntRichEdit11DblClick
OnSelectionChange = TntRichEdit11SelectionChange
end
object TntRichEdit12: TTntRichEdit
Left = 0
Top = 133
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 1
WantTabs = True
OnSelectionChange = TntRichEdit12SelectionChange
end
object TntGroupBox31: TTntGroupBox
Left = 404
Top = 0
Width = 265
Height = 54
TabOrder = 2
object TntButton31: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-8'#32534#30721#26684#24335#23383#33410#24207#21015#36716#25442#20026'UTF-16'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton31Click
end
object TntComboBox4: TTntComboBox
Left = 10
Top = 21
Width = 165
Height = 20
Style = csDropDownList
ItemHeight = 12
ItemIndex = 0
TabOrder = 1
Text = #19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
Items.Strings = (
#19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
#24102'BOM'#30340#22823#23614#23383#33410#24207#24207#21015
#24102'BOM'#30340#23567#23614#23383#33410#24207#24207#21015)
end
end
object TntRadioButton38: TTntRadioButton
Left = 410
Top = 0
Width = 141
Height = 17
Caption = 'UTF8ToUTF16ForBS'#20989#25968
Checked = True
TabOrder = 3
TabStop = True
OnClick = TntRadioButton38Click
end
object TntGroupBox32: TTntGroupBox
Left = 404
Top = 66
Width = 265
Height = 54
TabOrder = 4
object TntButton32: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-8'#32534#30721#26684#24335#23383#33410#24207#21015#36716#20026'UTF-32'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton32Click
end
object TntComboBox5: TTntComboBox
Left = 10
Top = 21
Width = 165
Height = 20
Style = csDropDownList
ItemHeight = 12
ItemIndex = 0
TabOrder = 1
Text = #19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
Items.Strings = (
#19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
#24102'BOM'#30340#22823#23614#23383#33410#24207#24207#21015
#24102'BOM'#30340#23567#23614#23383#33410#24207#24207#21015)
end
end
object TntRadioButton39: TTntRadioButton
Left = 410
Top = 66
Width = 141
Height = 17
Caption = 'UTF8ToUTF32ForBS'#20989#25968
TabOrder = 5
OnClick = TntRadioButton38Click
end
object TntGroupBox33: TTntGroupBox
Left = 404
Top = 133
Width = 265
Height = 54
TabOrder = 6
object TntButton33: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-16'#32534#30721#26684#24335#23383#33410#24207#21015#36716#20026'UTF-8'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton33Click
end
end
object TntRadioButton40: TTntRadioButton
Left = 410
Top = 133
Width = 141
Height = 17
Caption = 'UTF16ToUTF8ForBS'#20989#25968
TabOrder = 7
OnClick = TntRadioButton38Click
end
object TntGroupBox34: TTntGroupBox
Left = 404
Top = 202
Width = 265
Height = 54
TabOrder = 8
object TntButton34: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-16'#32534#30721#26684#24335#23383#33410#24207#21015#36716#20026'UTF-32'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton34Click
end
object TntComboBox6: TTntComboBox
Left = 10
Top = 21
Width = 165
Height = 20
Style = csDropDownList
ItemHeight = 12
ItemIndex = 0
TabOrder = 1
Text = #19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
Items.Strings = (
#19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
#24102'BOM'#30340#22823#23614#23383#33410#24207#24207#21015
#24102'BOM'#30340#23567#23614#23383#33410#24207#24207#21015)
end
end
object TntRadioButton41: TTntRadioButton
Left = 410
Top = 202
Width = 147
Height = 17
Caption = 'UTF16ToUTF32ForBS'#20989#25968
TabOrder = 9
OnClick = TntRadioButton38Click
end
object TntGroupBox35: TTntGroupBox
Left = 404
Top = 270
Width = 265
Height = 54
TabOrder = 10
object TntButton35: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-32'#32534#30721#26684#24335#23383#33410#24207#21015#36716#20026'UTF-8'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton35Click
end
end
object TntRadioButton42: TTntRadioButton
Left = 410
Top = 270
Width = 141
Height = 17
Caption = 'UTF32ToUTF8ForBS'#20989#25968
TabOrder = 11
OnClick = TntRadioButton38Click
end
object TntGroupBox36: TTntGroupBox
Left = 404
Top = 335
Width = 265
Height = 54
TabOrder = 12
object TntButton36: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-32'#32534#30721#26684#24335#23383#33410#24207#21015#36716#25442#20026'UTF-16'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton36Click
end
object TntComboBox7: TTntComboBox
Left = 10
Top = 21
Width = 165
Height = 20
Style = csDropDownList
ItemHeight = 12
ItemIndex = 0
TabOrder = 1
Text = #19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
Items.Strings = (
#19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
#24102'BOM'#30340#22823#23614#23383#33410#24207#24207#21015
#24102'BOM'#30340#23567#23614#23383#33410#24207#24207#21015)
end
end
object TntRadioButton43: TTntRadioButton
Left = 410
Top = 335
Width = 147
Height = 17
Caption = 'UTF32ToUTF16ForBS'#20989#25968
TabOrder = 13
OnClick = TntRadioButton38Click
end
end
object TntTabSheet11: TTntTabSheet
Caption = #36741#21161#27169#22359
OnShow = TntTabSheet11Show
object TntRichEdit13: TTntRichEdit
Left = 0
Top = 0
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
WantTabs = True
OnChange = TntRichEdit13Change
OnDblClick = TntRichEdit13DblClick
OnSelectionChange = TntRichEdit13SelectionChange
end
object TntRichEdit14: TTntRichEdit
Left = 0
Top = 133
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 1
WantTabs = True
OnSelectionChange = TntRichEdit14SelectionChange
end
object TntGroupBox37: TTntGroupBox
Left = 404
Top = 0
Width = 265
Height = 54
TabOrder = 2
object TntButton37: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #35745#31639'UTF-8'#32534#30721#26684#24335#23383#33410#24207#21015#20013#30340#23383#31526#25968#30446
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton37Click
end
end
object TntRadioButton44: TTntRadioButton
Left = 410
Top = 0
Width = 147
Height = 17
Caption = 'CharCountOfUTF8BS'#20989#25968
Checked = True
TabOrder = 3
TabStop = True
OnClick = TntRadioButton44Click
end
object TntGroupBox38: TTntGroupBox
Left = 404
Top = 64
Width = 265
Height = 54
TabOrder = 4
object TntButton38: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #35745#31639'UTF-16'#32534#30721#26684#24335#23383#33410#24207#21015#20013#30340#23383#31526#25968#30446
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton38Click
end
end
object TntRadioButton45: TTntRadioButton
Left = 410
Top = 64
Width = 153
Height = 17
Caption = 'CharCountOfUTF16BS'#20989#25968
TabOrder = 5
OnClick = TntRadioButton44Click
end
object TntGroupBox39: TTntGroupBox
Left = 404
Top = 128
Width = 265
Height = 54
TabOrder = 6
object TntButton39: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #35745#31639'UTF-32'#32534#30721#26684#24335#23383#33410#24207#21015#20013#30340#23383#31526#25968#30446
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton39Click
end
end
object TntRadioButton46: TTntRadioButton
Left = 410
Top = 128
Width = 153
Height = 17
Caption = 'CharCountOfUTF32BS'#20989#25968
TabOrder = 7
OnClick = TntRadioButton44Click
end
end
end
end
object TntTabSheet3: TTntTabSheet
Caption = #32534#30721#26684#24335#21644#32534#30721#26426#21046#32508#21512#22788#29702
OnShow = TntTabSheet1Show
object TntPageControl4: TTntPageControl
Left = 0
Top = 0
Width = 680
Height = 419
ActivePage = TntTabSheet13
Align = alClient
TabOrder = 0
TabPosition = tpBottom
object TntTabSheet12: TTntTabSheet
Caption = #19981#21516'UTF'#30340#32534#30721#26684#24335#21521#32534#30721#26426#21046#30340#36716#25442
OnShow = TntTabSheet12Show
object TntRichEdit15: TTntRichEdit
Left = 0
Top = 0
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
WantTabs = True
OnChange = TntRichEdit15Change
OnDblClick = TntRichEdit15DblClick
OnSelectionChange = TntRichEdit15SelectionChange
end
object TntRichEdit16: TTntRichEdit
Left = 0
Top = 133
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 1
WantTabs = True
OnSelectionChange = TntRichEdit16SelectionChange
end
object TntGroupBox40: TTntGroupBox
Left = 404
Top = 0
Width = 265
Height = 54
TabOrder = 2
object TntButton40: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-8'#32534#30721#21333#20803#24207#21015#36716#25442#20026'UTF-16'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton40Click
end
object TntComboBox8: TTntComboBox
Left = 10
Top = 21
Width = 165
Height = 20
Style = csDropDownList
ItemHeight = 12
ItemIndex = 0
TabOrder = 1
Text = #19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
Items.Strings = (
#19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
#24102'BOM'#30340#22823#23614#23383#33410#24207#24207#21015
#24102'BOM'#30340#23567#23614#23383#33410#24207#24207#21015)
end
end
object TntRadioButton47: TTntRadioButton
Left = 410
Top = 0
Width = 141
Height = 17
Caption = 'UTF8CUSToUTF16BS'#20989#25968
Checked = True
TabOrder = 3
TabStop = True
OnClick = TntRadioButton47Click
end
object TntGroupBox41: TTntGroupBox
Left = 404
Top = 66
Width = 265
Height = 54
TabOrder = 4
object TntButton41: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-8'#32534#30721#21333#20803#24207#21015#36716#20026'UTF-32'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton41Click
end
object TntComboBox9: TTntComboBox
Left = 10
Top = 21
Width = 165
Height = 20
Style = csDropDownList
ItemHeight = 12
ItemIndex = 0
TabOrder = 1
Text = #19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
Items.Strings = (
#19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
#24102'BOM'#30340#22823#23614#23383#33410#24207#24207#21015
#24102'BOM'#30340#23567#23614#23383#33410#24207#24207#21015)
end
end
object TntRadioButton48: TTntRadioButton
Left = 410
Top = 66
Width = 141
Height = 17
Caption = 'UTF8CUSToUTF32BS'#20989#25968
TabOrder = 5
OnClick = TntRadioButton47Click
end
object TntGroupBox42: TTntGroupBox
Left = 404
Top = 133
Width = 265
Height = 54
TabOrder = 6
object TntButton42: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-16'#32534#30721#21333#20803#24207#21015#36716#20026'UTF-8'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton42Click
end
end
object TntRadioButton49: TTntRadioButton
Left = 410
Top = 133
Width = 141
Height = 17
Caption = 'UTF16CUSToUTF8BS'#20989#25968
TabOrder = 7
OnClick = TntRadioButton47Click
end
object TntGroupBox43: TTntGroupBox
Left = 404
Top = 202
Width = 265
Height = 54
TabOrder = 8
object TntButton43: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-16'#32534#30721#21333#20803#24207#21015#36716#20026'UTF-32'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton43Click
end
object TntComboBox10: TTntComboBox
Left = 10
Top = 21
Width = 165
Height = 20
Style = csDropDownList
ItemHeight = 12
ItemIndex = 0
TabOrder = 1
Text = #19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
Items.Strings = (
#19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
#24102'BOM'#30340#22823#23614#23383#33410#24207#24207#21015
#24102'BOM'#30340#23567#23614#23383#33410#24207#24207#21015)
end
end
object TntRadioButton50: TTntRadioButton
Left = 410
Top = 202
Width = 147
Height = 17
Caption = 'UTF16CUSToUTF32BS'#20989#25968
TabOrder = 9
OnClick = TntRadioButton47Click
end
object TntGroupBox44: TTntGroupBox
Left = 404
Top = 270
Width = 265
Height = 54
TabOrder = 10
object TntButton44: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-32'#32534#30721#21333#20803#24207#21015#36716#20026'UTF-8'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton44Click
end
end
object TntRadioButton51: TTntRadioButton
Left = 410
Top = 270
Width = 141
Height = 17
Caption = 'UTF32CUSToUTF8BS'#20989#25968
TabOrder = 11
OnClick = TntRadioButton47Click
end
object TntGroupBox45: TTntGroupBox
Left = 404
Top = 335
Width = 265
Height = 54
TabOrder = 12
object TntButton45: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = 'UTF-32'#32534#30721#21333#20803#24207#21015#36716'UTF-16'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton45Click
end
object TntComboBox11: TTntComboBox
Left = 10
Top = 21
Width = 165
Height = 20
Style = csDropDownList
ItemHeight = 12
ItemIndex = 0
TabOrder = 1
Text = #19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
Items.Strings = (
#19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
#24102'BOM'#30340#22823#23614#23383#33410#24207#24207#21015
#24102'BOM'#30340#23567#23614#23383#33410#24207#24207#21015)
end
end
object TntRadioButton52: TTntRadioButton
Left = 410
Top = 335
Width = 147
Height = 17
Caption = 'UTF32CUSToUTF16BS'#20989#25968
TabOrder = 13
OnClick = TntRadioButton47Click
end
end
object TntTabSheet13: TTntTabSheet
Caption = #19981#21516'UTF'#30340#32534#30721#26426#21046#21521#32534#30721#26684#24335#30340#36716#25442
OnShow = TntTabSheet13Show
object TntRichEdit17: TTntRichEdit
Left = 0
Top = 0
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
WantTabs = True
OnChange = TntRichEdit17Change
OnDblClick = TntRichEdit17DblClick
OnSelectionChange = TntRichEdit17SelectionChange
end
object TntRichEdit18: TTntRichEdit
Left = 0
Top = 133
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 1
WantTabs = True
OnSelectionChange = TntRichEdit18SelectionChange
end
object TntGroupBox46: TTntGroupBox
Left = 404
Top = 0
Width = 265
Height = 54
TabOrder = 2
object TntButton46: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-8'#32534#30721#26684#24335#23383#33410#24207#21015#36716#20026'UTF-16'#32534#30721#21333#20803#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton46Click
end
end
object TntRadioButton53: TTntRadioButton
Left = 410
Top = 0
Width = 141
Height = 17
Caption = 'UTF8BSToUTF16CUS'#20989#25968
Checked = True
TabOrder = 3
TabStop = True
OnClick = TntRadioButton53Click
end
object TntGroupBox47: TTntGroupBox
Left = 404
Top = 66
Width = 265
Height = 54
TabOrder = 4
object TntButton47: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-8'#32534#30721#26684#24335#23383#33410#24207#21015#36716#20026'UTF-32'#32534#30721#21333#20803#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton47Click
end
end
object TntRadioButton54: TTntRadioButton
Left = 410
Top = 66
Width = 141
Height = 17
Caption = 'UTF8BSToUTF32CUS'#20989#25968
TabOrder = 5
OnClick = TntRadioButton53Click
end
object TntGroupBox48: TTntGroupBox
Left = 404
Top = 133
Width = 265
Height = 54
TabOrder = 6
object TntButton48: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-16'#32534#30721#26684#24335#23383#33410#24207#21015#36716#20026'UTF-8'#32534#30721#21333#20803#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton48Click
end
object TntComboBox12: TTntComboBox
Left = 10
Top = 21
Width = 165
Height = 20
Style = csDropDownList
ItemHeight = 12
ItemIndex = 0
TabOrder = 1
Text = #19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
OnSelect = TntComboBox12Select
Items.Strings = (
#19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
#24102'BOM'#30340#22823#23614#23383#33410#24207#24207#21015
#24102'BOM'#30340#23567#23614#23383#33410#24207#24207#21015)
end
end
object TntRadioButton55: TTntRadioButton
Left = 410
Top = 133
Width = 141
Height = 17
Caption = 'UTF16BSToUTF8CUS'#20989#25968
TabOrder = 7
OnClick = TntRadioButton53Click
end
object TntGroupBox49: TTntGroupBox
Left = 404
Top = 202
Width = 265
Height = 54
TabOrder = 8
object TntButton49: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-16'#32534#30721#26684#24335#23383#33410#24207#21015#36716#20026'UTF-32'#32534#30721#21333#20803#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton49Click
end
object TntComboBox14: TTntComboBox
Left = 10
Top = 21
Width = 165
Height = 20
Style = csDropDownList
ItemHeight = 12
ItemIndex = 0
TabOrder = 1
Text = #19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
OnSelect = TntComboBox12Select
Items.Strings = (
#19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
#24102'BOM'#30340#22823#23614#23383#33410#24207#24207#21015
#24102'BOM'#30340#23567#23614#23383#33410#24207#24207#21015)
end
end
object TntRadioButton56: TTntRadioButton
Left = 410
Top = 202
Width = 147
Height = 17
Caption = 'UTF16BSToUTF32CUS'#20989#25968
TabOrder = 9
OnClick = TntRadioButton53Click
end
object TntGroupBox50: TTntGroupBox
Left = 404
Top = 270
Width = 265
Height = 54
TabOrder = 10
object TntButton50: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226'UTF-32'#32534#30721#26684#24335#23383#33410#24207#21015#36716#20026'UTF-8'#32534#30721#21333#20803#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton50Click
end
object TntComboBox13: TTntComboBox
Left = 10
Top = 21
Width = 165
Height = 20
Style = csDropDownList
ItemHeight = 12
ItemIndex = 0
TabOrder = 1
Text = #19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
OnSelect = TntComboBox12Select
Items.Strings = (
#19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
#24102'BOM'#30340#22823#23614#23383#33410#24207#24207#21015
#24102'BOM'#30340#23567#23614#23383#33410#24207#24207#21015)
end
end
object TntRadioButton57: TTntRadioButton
Left = 410
Top = 270
Width = 141
Height = 17
Caption = 'UTF32BSToUTF8CUS'#20989#25968
TabOrder = 11
OnClick = TntRadioButton53Click
end
object TntGroupBox51: TTntGroupBox
Left = 404
Top = 335
Width = 265
Height = 54
TabOrder = 12
object TntButton51: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = 'UTF-32'#32534#30721#26684#24335#23383#33410#24207#21015#36716'UTF-16'#32534#30721#21333#20803#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton51Click
end
object TntComboBox15: TTntComboBox
Left = 10
Top = 21
Width = 165
Height = 20
Style = csDropDownList
ItemHeight = 12
ItemIndex = 0
TabOrder = 1
Text = #19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
OnSelect = TntComboBox12Select
Items.Strings = (
#19981#24102'BOM'#30340#40664#35748#23383#33410#24207#24207#21015
#24102'BOM'#30340#22823#23614#23383#33410#24207#24207#21015
#24102'BOM'#30340#23567#23614#23383#33410#24207#24207#21015)
end
end
object TntRadioButton58: TTntRadioButton
Left = 410
Top = 335
Width = 147
Height = 17
Caption = 'UTF32BSToUTF16CUS'#20989#25968
TabOrder = 13
OnClick = TntRadioButton53Click
end
end
end
end
object TntTabSheet4: TTntTabSheet
Caption = #36741#21161#27169#22359
OnShow = TntTabSheet1Show
object TntPageControl5: TTntPageControl
Left = 0
Top = 0
Width = 680
Height = 419
ActivePage = TntTabSheet15
Align = alClient
TabOrder = 0
TabPosition = tpBottom
object TntTabSheet14: TTntTabSheet
Caption = #21028#26029#26410#30693#32534#30721#26684#24335#23383#33410#24207#21015#30340#31867#22411
OnShow = TntTabSheet14Show
object TntRichEdit19: TTntRichEdit
Left = 0
Top = 0
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
WantTabs = True
OnChange = TntRichEdit19Change
OnSelectionChange = TntRichEdit19SelectionChange
end
object TntRichEdit20: TTntRichEdit
Left = 0
Top = 133
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 1
WantTabs = True
OnSelectionChange = TntRichEdit20SelectionChange
end
object TntGroupBox52: TTntGroupBox
Left = 404
Top = 0
Width = 265
Height = 54
Caption = 'GuessUTF8BSAvaiByteCount'#20989#25968
TabOrder = 2
object TntButton52: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #22312#19968#20010#26410#30693#32534#30721#26684#24335#30340#23383#33410#24207#21015#20013#25353#29031'UTF-8 '#32534#30721#26426#21046#30340#35268#21017#65292#35745#31639#20986#20840#37096#26377#25928#23383#31526#30340#23383#33410#24207#21015#24635#38271#24230
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton52Click
end
end
object TntGroupBox53: TTntGroupBox
Left = 404
Top = 66
Width = 265
Height = 54
Caption = 'GuessUTF16BSAvaiByteCount'#20989#25968
TabOrder = 3
object TntButton53: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #22312#19968#20010#26410#30693#32534#30721#26684#24335#30340#23383#33410#24207#21015#20013#25353#29031'UTF-16'#32534#30721#26426#21046#30340#35268#21017#65292#35745#31639#20986#20840#37096#26377#25928#23383#31526#30340#23383#33410#24207#21015#24635#38271#24230
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton53Click
end
end
object TntGroupBox54: TTntGroupBox
Left = 404
Top = 133
Width = 265
Height = 54
Caption = 'GuessUTF32BSAvaiByteCount'#20989#25968
TabOrder = 4
object TntButton54: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #22312#19968#20010#26410#30693#32534#30721#26684#24335#30340#23383#33410#24207#21015#20013#25353#29031'UTF-32'#32534#30721#26426#21046#30340#35268#21017#65292#35745#31639#20986#20840#37096#26377#25928#23383#31526#30340#23383#33410#24207#21015#24635#38271#24230
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton54Click
end
end
object TntGroupBox55: TTntGroupBox
Left = 404
Top = 200
Width = 265
Height = 54
Caption = 'BOMTypeOfUTF8BS'#20989#25968
TabOrder = 5
object TntButton55: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #26816#27979#19968#20010'UTF-8'#32534#30721#26684#24335#23383#33410#24207#21015#30340'BOM'#31867#22411
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton55Click
end
end
object TntGroupBox56: TTntGroupBox
Left = 404
Top = 269
Width = 265
Height = 54
Caption = 'BOMTypeOfUTF16BS'#20989#25968
TabOrder = 6
object TntButton56: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #26816#27979#19968#20010'UTF-16'#32534#30721#26684#24335#23383#33410#24207#21015#30340'BOM'#31867#22411
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton56Click
end
end
object TntGroupBox57: TTntGroupBox
Left = 404
Top = 334
Width = 265
Height = 54
Caption = 'BOMTypeOfUTF32BS'#20989#25968
TabOrder = 7
object TntButton57: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #26816#27979#19968#20010'UTF-32'#32534#30721#26684#24335#23383#33410#24207#21015#30340'BOM'#31867#22411
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton57Click
end
end
object TntGroupBox58: TTntGroupBox
Left = 134
Top = 269
Width = 265
Height = 54
Caption = 'GuessBSType'#20989#25968
TabOrder = 8
object TntButton58: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #8220#29468#27979#8221#19968#20010#26410#30693#32534#30721#26684#24335#30340#23383#33410#24207#21015#25152#20351#29992#30340'Unicode'#32534#30721#26426#21046#31867#22411
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton58Click
end
end
end
object TntTabSheet15: TTntTabSheet
Caption = #25991#26412#25991#20214'I/O'
OnShow = TntTabSheet15Show
object TntRichEdit21: TTntRichEdit
Left = 0
Top = 0
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 0
WantTabs = True
OnChange = TntRichEdit21Change
OnSelectionChange = TntRichEdit21SelectionChange
end
object TntRichEdit22: TTntRichEdit
Left = 0
Top = 133
Width = 399
Height = 132
Cursor = crArrow
TabStop = False
Align = alCustom
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Sun-ExtB'
Font.Style = []
HideSelection = False
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 1
WantTabs = True
OnSelectionChange = TntRichEdit22SelectionChange
end
object TntGroupBox59: TTntGroupBox
Left = 404
Top = 0
Width = 265
Height = 54
Caption = 'SaveUniByteSequToFile'#20989#25968
TabOrder = 2
object TntButton59: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #25226#19968#20010'Unicode'#32534#30721#26684#24335#23383#33410#24207#21015#20889#20986#21040#25351#23450#30340#25991#20214#20013
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton59Click
end
end
object TntGroupBox60: TTntGroupBox
Left = 404
Top = 66
Width = 265
Height = 54
Caption = 'LoadUniByteSequFromFile'#20989#25968
TabOrder = 3
object TntButton60: TTntButton
Left = 180
Top = 21
Width = 75
Height = 25
Hint = #20174#25991#26412#25991#20214#20013#35835#20837'Unicode'#32534#30721#26684#24335#23383#33410#24207#21015
Caption = #35797#32451
TabOrder = 0
OnClick = TntButton60Click
end
end
end
end
end
end
object TntOpenDialog1: TTntOpenDialog
Left = 160
Top = 235
end
object TntSaveDialog1: TTntSaveDialog
Left = 192
Top = 235
end
end