Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Quintaros on Tue 29/04/2008 12:05:28

Title: Question regarding String.CompareTo
Post by: Quintaros on Tue 29/04/2008 12:05:28
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.
Title: Re: Question regarding String.CompareTo
Post by: SSH on Tue 29/04/2008 13:02:06
That seems pretty convoluted. Why not:


char letter=input.ReadRawChar();
if (letter==' ')... // space
if (letter==13 || letter==10) ... //CR or LF, i.e. end of line
Title: Re: Question regarding String.CompareTo
Post by: Quintaros on Tue 29/04/2008 13:59:30
I'm all for simplicity.  I will give that a try.