Question regarding String.CompareTo

Started by Quintaros, Tue 29/04/2008 12:05:28

Previous topic - Next topic

Quintaros

I'm trying to write a script that reads from a text file using:

String letter= String.Format("%c", input.ReadRawChar());

I use: (letter.CompareTo(" ")==0) to check if the letter is a character or space but I run into problems when I reach a line break. 

Can someone tell me what kind of check I should do for line breaks?

Thanks.

SSH

That seems pretty convoluted. Why not:

Code: ags

char letter=input.ReadRawChar();
if (letter==' ')... // space
if (letter==13 || letter==10) ... //CR or LF, i.e. end of line
12

Quintaros

I'm all for simplicity.  I will give that a try.

SMF spam blocked by CleanTalk