foreach over string
John Colvin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat May 24 11:18:35 PDT 2014
On Saturday, 24 May 2014 at 16:46:42 UTC, Kagamin wrote:
> foreach over string apparently iterates over chars by default
> instead of dchars. Didn't it prefer dchars?
>
> string s="weiß";
> int i;
> foreach(c;s)i++;
> assert(i==5);
Nope.
if you use foreach(dchar c; s) you will get the iteration by
code-point you are looking for.
More information about the Digitalmars-d-learn
mailing list