[fpc-devel] for-in-index loop

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Jan 25 11:23:12 CET 2013


Michael Schnell <mschnell at lumino.de> hat am 25. Januar 2013 um 11:09
geschrieben:
> 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

Do you mean codepoint?
Printable depends on ligatures and other things.


> Finding the 100000 th and then independently the 100005 th printable
> character needs quite a lot of CPU time

In UTF8, UTF16 and UTF32 it takes 5 steps.

>, 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.

There are plenty of functions for this. You can wrap them into enumerators as
demonstrated.

Mattias



More information about the fpc-devel mailing list