== Quote from ZY Zhou (rin...@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 :)