Break/Continue Structure
    Oskar Linde 
    olREM at OVEnada.kth.se
       
    Fri Mar 24 00:05:30 PST 2006
    
    
  
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
    
    
More information about the Digitalmars-d-learn
mailing list