[Lazarus] String with °
DrDiettrich1 at aol.com
Thu Oct 10 11:10:39 CEST 2013
Kamen Kamen schrieb:
> I have string with ° and I want to delete all symbols to °. When I
> delete symbol ° returns #176. How can I delete this symbol?
> Exampe: s := '49°45 ';
> After: delete (s, 1, 2); --> '°45 '
> After: delete (s, 1, 1); or delete (s, pos ('°', s), 1); --> #176'45 '
> I want to reseive only '45 '.
Most probably '°' is a multi-byte UTF-8 symbol. You can declare it as a
const Deg: UTF8string = '°';
and obtain the part past it using
NextPos := Pos(Deg,s)+ Length(Deg);
Tail := Copy(s, NextPos, Length(s));
When working with strings containing non-ASCII characters you should
forget about Char and character (byte) based functions. Use strings
instead, even for single letters, and the string based functions (Pos,
More information about the Lazarus