Break/Continue Structure

Derek Parnell derek at psych.ward
Fri Mar 24 15:42:19 PST 2006


On Fri, 24 Mar 2006 19:05:30 +1100, Oskar Linde <olREM at OVEnada.kth.se>  
wrote:

> Derek Parnell wrote:
>
>> BTW, using the foreach this way can be misleading. The pointer value
>> returned represents the number of dchars examined and *not* an index  
>> into
>> theString. This is significant if theString is not a dchar[].
>
> That is not correct. The index returned is an index into the char[]  
> array,
> not the number of dchars processed:
>
> void main() {
>         foreach(uint ix, dchar c; "åäö"c)
>                 writefln("c = %s, ix = %s",c,ix);
> }
>
> Prints:
>
> c = å, ix = 0
> c = ä, ix = 2
> c = ö, ix = 4
>
> /Oskar

Thanks. It didn't used to be this way, I believe.

-- 
Derek Parnell
Melbourne, Australia



More information about the Digitalmars-d-learn mailing list