how do i get the number of visible charcters in a UTF8String regardless of how many bytes it takes to hold the string?
how do i get the number of visible charcters in a UTF8String regardless of how many bytes it takes to hold the string?
If you under Windows, try CharNextW:
uses
Winapi.Windows,
System.SysUtils;
function GetCharsCount(const AStr: UTF8String): Integer;
var
P: PWideChar;
begin
Result := 0;
P := PWideChar(UnicodeString(AStr));
while P <> '' do begin
Inc(Result);
P := CharNextW(P);
end;
end;