mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 19:49:18 +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;
|
||||
|
||||
function CharLengthPChar(const Str: PChar): PtrInt;
|
||||
// return the number of codepoints (including invalid codepoints)
|
||||
var
|
||||
p: PChar;
|
||||
l: Integer;
|
||||
begin
|
||||
{$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;
|
||||
|
||||
function AnsiCompareStr(const s1, s2: ansistring): PtrInt;
|
||||
|
Loading…
Reference in New Issue
Block a user