type
TStringArray = array of String;
function BuffTextEqualAsm(const Str1, Str2: PChar; MaxLen: Cardinal): Boolean; assembler;
asm
PUSH EDI
PUSH ESI
PUSH EBX
MOV EDI,EDX
MOV ESI,EAX
MOV EBX,ECX
XOR EAX,EAX
OR ECX,ECX
JE @@T
REPNE SCASB
SUB EBX,ECX
MOV ECX,EBX
MOV EDI,EDX
XOR EDX,EDX
@@1:
REPE CMPSB
JE @@T
MOV AL,[ESI-1]
CMP AL,'a'
JB @@2
CMP AL,'z'
JA @@2
SUB AL,20H
@@2:
MOV DL,[EDI-1]
CMP DL,'a'
JB @@3
CMP DL,'z'
JA @@3
SUB DL,20H
@@3:
SUB EAX,EDX
JE @@1
@@F:
xor EAX,EAX
jmp @@E
@@T:
mov EAX,1
@@E:
POP EBX
POP ESI
POP EDI
end;
function IndexedWithToken(const Src: String;const Index: Integer;Token:String = ','): String;
var
P, Start : PChar;
tkLength : Integer;
LocalIndex : Integer;
begin
Result := '';
LocalIndex := 1;
tkLength := Length(Token);
P := Pointer(Src);
Start := P;
if Index <= 0 then Exit;
if P <> nil then begin
while P^ <> #0 do
begin
while Not ((P^ In [#0]) or BuffTextEqualAsm(P,Pointer(Token),tkLength)) do Inc(P);
if P <> Start then
begin
if LocalIndex = Index then
begin
SetString(Result, Start, Integer(P - Start));
Exit;
end;
end;
if P^ = #0 then break;
Inc(LocalIndex);
Inc(P,tkLength);
Start := P;
end;
end;
if P <> Start then
begin
if LocalIndex = Index then
begin
SetString(Result, Start, Integer(P - Start));
Exit;
end;
end;
end;
procedure StringSplit(SourceStr,SplitStr: string;var SplitStrs: TStringArray);
var
i: Integer;
str: string;
begin
i := 1;
while True do
begin
str := IndexedWithToken(SourceStr,i,SplitStr);
if str <> '' then
begin
SetLength(SplitStrs,i);
SplitStrs[i-1] := str;
end
else Break;
Inc(i);
end;
end;