More on StringToken
Ellery Newcomer
ellery-newcomer at utulsa.edu
Thu Jun 24 07:14:59 PDT 2010
On 06/24/2010 06:35 AM, Ben Hanson wrote:
> It seems like the best way to go is to use dchar for strings (i.e. not have
> the struct as a template) as I need real characters for intersection purposes.
> When it comes to lookup, any input will need converting to dchars (I expect
> this can be done on the fly).
>
> In C++ you would use iterators to do this kind of input conversion. I don't
> know what the technique is in D.
>
> Regards,
>
> Ben
like
import std.array;
string s;
dchar first = s.front;
dchar last = s.back;
or
import std.utf
string s;
int old_offset;
int offset = stride(s, old_offset)
dchar d = decode(s, old_offset + offset);
?
More information about the Digitalmars-d
mailing list