I have a small script that takes a string and turns it into an array of chars via the .ToCharArray function. Works like a dream. Except that I’m having trouble figuring out how to detect a new line character.
By example, if I have the following string:
“hello every
nice to meet you”
There’s a newline after “every”. If I Debug.Log() that char, it shows up as " ", the same as a space. I tried this: if(stringAsCharArray[charIndex].ToString() == System.Environment.NewLine)
but that doesn’t seem to pick it up, either.
What’s the best way to figure out if a char is actually a newline character?