[Lazarus] String with °

Michael Van Canneyt michael at freepascal.org
Thu Oct 10 10:57:18 CEST 2013



On Thu, 10 Oct 2013, Kamen Kamen wrote:

> 
> Hello,
> 
> I have string with ° and I want to delete all symbols to °. When I delete symbol ° returns #176. How can I delete this symbol?

What is the encoding of this string ? UTF8 ?

> 
> Exampe: s := '49°45 ';
> 
> After: delete (s, 1, 2); --> '°45 '
> 
> After: delete (s, 1, 1); or delete (s, pos ('°', s), 1); -->  #176'45 '

Delete uses a byte count, not a char count. If your string is encoded in UTF-8, then you will probably get the behaviour you see.

To my knowledge, there is currently no routine in the RTL that does this correct.

Michael.


More information about the Lazarus mailing list