[Lazarus] How to use strings properly with fixes_1_6 and FPC 3.0.0?

Gabor Boros gaborboros at yahoo.com
Fri Oct 21 14:24:47 CEST 2016


2016. 10. 21. 12:38 keltezéssel, Juha Manninen via Lazarus írta:

>> for i:=1 to UTF8Length(s) do Write(UTF8Copy(s,i,1))
>
> No, it not a good solution!
> I predict that most your code can still use byte indexing. At some
> point you will get a Heureka-moment like "hey, I don't need the
> codepoint index when doing this task!".

Juha, thank you for your patience and sorry if I am a completely idiot 
but... :-)

Why the below example better than a for loop with UTF8Length and 
UTF8Copy for go through the string?

I hope my "Heureka-moment" coming shortly! :D

http://wiki.freepascal.org/UTF8_strings_and_characters#Iterating_over_string_analysing_individual_codepoints

Gabor


More information about the Lazarus mailing list