T
TENTODBV
Unregistered / Unconfirmed
GUEST, unregistred user!
function ReverseString(const AText: string): string;
var
I: Integer;
P: PChar;
begin
SetLength(Result, Length(AText));
P := PChar(Result);
for I := Length(AText) downto 1 do
begin
P^ := AText;
Inc(P);
end;
end;
function AnsiReverseString(const AText: AnsiString): AnsiString;
var
I: Integer;
Len, CharByteLen: Integer;
L, R, RR, Tail: PAnsiChar;
begin
Len := Length(AText);
SetLength(Result, Len);
if AText = '' then exit;
L := PAnsiChar(AText);
Tail := L+Len;
R := PAnsiChar(Result)+Len;
while L < Tail do
begin
CharByteLen := 1;
if L^ in LeadBytes then
CharByteLen := StrCharLength(L);
RR := R - CharByteLen;
R := RR;
for I := 0 to CharByteLen - 1 do
begin
RR^ := L^;
Inc(L);
Inc(RR);
end;
end;
end;
var
I: Integer;
P: PChar;
begin
SetLength(Result, Length(AText));
P := PChar(Result);
for I := Length(AText) downto 1 do
begin
P^ := AText;
Inc(P);
end;
end;
function AnsiReverseString(const AText: AnsiString): AnsiString;
var
I: Integer;
Len, CharByteLen: Integer;
L, R, RR, Tail: PAnsiChar;
begin
Len := Length(AText);
SetLength(Result, Len);
if AText = '' then exit;
L := PAnsiChar(AText);
Tail := L+Len;
R := PAnsiChar(Result)+Len;
while L < Tail do
begin
CharByteLen := 1;
if L^ in LeadBytes then
CharByteLen := StrCharLength(L);
RR := R - CharByteLen;
R := RR;
for I := 0 to CharByteLen - 1 do
begin
RR^ := L^;
Inc(L);
Inc(RR);
end;
end;
end;