[fpc-devel] for-in-index loop

Hans-Peter Diettrich DrDiettrich1 at aol.com
Fri Jan 25 18:52:08 CET 2013


Michael Schnell schrieb:
> On 01/25/2013 10:52 AM, Mattias Gaertner wrote:
>> The above UTF8 example misses some points....
> My question was about the want for a construct that allows for accessing 
> the n'th printable character in an UTF-8 string

Everybody can write such a subroutine, when really needed. Or use what 
the RTL provides for such purpose...

> Finding the 100000 th and then independently the 100005 th printable 
> character needs quite a lot of CPU time, so it would be nice to have a 
> kind of "enumerator" that (e.g.) in a smart way remembers a set of 
> (Byte_Position / printable_Character_position) pairs helping to quickly 
> find the n'th printable character.

I think that you are abusing strings for demonstration purposes only. I 
bet that you really wanted the 100001th character, because you made an 
mistake while counting characters, or that you missed to organize your 
super-long string into smaller pieces (lines, columns...).

DoDi




More information about the fpc-devel mailing list