unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
PtuerkischesAlphabet = ^TtuerkischesAlphabet;
TtuerkischesAlphabet =
array[0..9]
of WideChar;
PkyrillischesAlphabet = ^TkyrillischesAlphabet;
TkyrillischesAlphabet =
array[0..63]
of WideChar;
PalbanischesAlphabet = ^TalbanischesAlphabet;
TalbanischesAlphabet =
array[0..3]
of WideChar;
TSonderzeichen =
array[0..2]
of Pointer;
const
tuerkischesAlphabet: TtuerkischesAlphabet = (#226, #199, #231, #286,
#287, #304, #305, #238, #350, #351);
kyrillischesAlphabet: TkyrillischesAlphabet =(#1040, #1041, #1042,
#1043, #1044, #1045, #1046, #1047, #1048, #1049, #1050, #1051, #1052,
#1053, #1054, #1055, #1056, #1057, #1058, #1059, #1060, #1061, #1062,
#1063, #1064, #1065, #1066, #1067, #1068, #1069, #1070, #1071, #1072,
#1073, #1074, #1075, #1076, #1077, #1078, #1079, #1080, #1081, #1082,
#1083, #1084, #1085, #1086, #1087, #1088, #1089, #1090, #1091, #1092,
#1063, #1094, #1095, #1096, #1097, #1098, #1099, #1100, #1101, #1102,
#1103);
albanischesAlphabet: TalbanischesAlphabet =(#199, #231, #203, #235);
type
TForm1 =
class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
Sonderzeichen: TSonderzeichen;
p1,p2,p3: Pointer;
function GetCharAtArrayPos(
const MainIndex,ArrIndex: integer): WideChar;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
GetMem(p1,SizeOf(tuerkischesAlphabet));
PtuerkischesAlphabet(p1)^ := tuerkischesAlphabet;
Sonderzeichen[0] := p1;
GetMem(p2,SizeOf(kyrillischesAlphabet));
PkyrillischesAlphabet(p2)^ := kyrillischesAlphabet;
Sonderzeichen[1] := p2;
GetMem(p3,SizeOf(albanischesAlphabet));
PalbanischesAlphabet(p3)^ := albanischesAlphabet;
Sonderzeichen[2] := p3;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FreeMem(p1,SizeOf(PtuerkischesAlphabet(p1)^));
FreeMem(p2,SizeOf(PkyrillischesAlphabet(p2)^));
FreeMem(p3,SizeOf(PalbanischesAlphabet(p3)^));
end;
function TForm1.GetCharAtArrayPos(
const MainIndex,ArrIndex: integer): WideChar;
procedure ShowError(
const Msg:
string);
begin
raise Exception.Create(Msg);
exit;
end;
begin
Result := #0;
case MainIndex
of
0:
if ArrIndex
in [0..9]
then
Result := PtuerkischesAlphabet(Sonderzeichen[MainIndex])^[ArrIndex]
else
ShowError('
ArrIndex out of bounds');
1:
if ArrIndex
in [0..63]
then
Result := PkyrillischesAlphabet(Sonderzeichen[MainIndex])^[ArrIndex]
else
ShowError('
ArrIndex out of bounds');
2:
if ArrIndex
in [0..3]
then
Result := PalbanischesAlphabet(Sonderzeichen[MainIndex])^[ArrIndex]
else
ShowError('
ArrIndex out of bounds');
else ShowError('
MainIndex out of bounds');
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(Format('
%d',[Ord(GetCharAtArrayPos(2,3))]));
end;
end.