Possible Duplicate:
Easiest way to split a string on newlines in .net?
I’m trying to read out and interpret a string line per line. I took a look at the StringReader class, but I need to find out when I’m on the last line. Here’s some pseudocode of what I’m trying to accomplish:
while (!stringReaderObject.atEndOfStream()) {
interpret(stringReaderObject.readLine());
}
Does somebody know how to do this?
Thanks!
Yvan
If you are reading it in from a file, it is easier to do just do:
If you are getting the string from somewhere else (a web service class or the like) it is simpler to just split the string: