On 2014-05-24 12:46, 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);
A string is defined by:
alias string = immutable(char)[];
It doesn't add anything to that type (unless you import a library like
std.algorithm, which adds many "methods" thanks to UFCS and generic
functions)
I believe you are looking for dstring which is defined by:
alias dstring = immutable(dchar)[];
dstring s="weiß";
int i;
foreach(c;s)i++;
assert(i==4);