function GetLastUtfCodePoint(const S: String): String;
var
p: PChar;
PLen: PtrInt;
begin
Result := '';
p := UTF8CodepointStart(PChar(S), Length(S), Utf8Length(S) - 1);
PLen := UTF8CodepointSize(p);
Result := p;
SetLength(Result,PLen);
end;
var
s: string;
begin
c := GetLastUtfCodePoint(s);
end.