mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 17:40:40 +02:00
lazutils: paswstring: fixed CharLengthPChar
git-svn-id: trunk@47096 -
This commit is contained in:
parent
a937271d53
commit
191c86fdf6
@ -174,9 +174,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function CharLengthPChar(const Str: PChar): PtrInt;
|
function CharLengthPChar(const Str: PChar): PtrInt;
|
||||||
|
// return the number of codepoints (including invalid codepoints)
|
||||||
|
var
|
||||||
|
p: PChar;
|
||||||
|
l: Integer;
|
||||||
begin
|
begin
|
||||||
{$ifdef PASWSTRING_VERBOSE}WriteLn('CharLengthPChar START');{$endif}
|
{$ifdef PASWSTRING_VERBOSE}WriteLn('CharLengthPChar START');{$endif}
|
||||||
Result := UTF8CharacterLength(Str);
|
p:=Str;
|
||||||
|
if p=nil then exit(0);
|
||||||
|
while p^<>#0 do begin
|
||||||
|
l:=UTF8CharacterLength(p);
|
||||||
|
inc(Result);
|
||||||
|
inc(p,l);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function AnsiCompareStr(const s1, s2: ansistring): PtrInt;
|
function AnsiCompareStr(const s1, s2: ansistring): PtrInt;
|
||||||
|
Loading…
Reference in New Issue
Block a user