string need to be robust

%u e at ee.com
Sun Mar 13 05:01:28 PDT 2011


== Quote from ZY Zhou (rinick at GeeMail.com)'s article
> std.utf throw exception instead of crash the program. but you still need to add
> try/catch everywhere.
> My point is: this simple code should work, instead of crash, it is supposed to
> leave all invalid codes untouched and just process the valid parts.
> Stream file = new BufferedFile("sample.txt");
> foreach(char[] line; file) {
>    string s = line.idup.tolower;
> }

At first glance I would like to overload the opInvalid? function in the stream
such that iso a throw, the char would be ignored.
Disclaimer: I don't know D2 nor streams :)


More information about the Digitalmars-d mailing list