I know that System.String.Split(null)
should return me a string array with whitespace removed. I've read this post and this MSDN doc, which does not agree with what I'm experiencing.
Here's my code:
void MyFunction(string info)
{
print(info);
print(Char.IsWhiteSpace(info,0));
print(Char.IsWhiteSpace(info,1));
print(Char.IsWhiteSpace(info,2));
print(Char.IsWhiteSpace(info,3));
print(Char.IsWhiteSpace(info,4));
print(Char.IsWhiteSpace(info,5));
print(Char.IsWhiteSpace(info,6));
print(Char.IsWhiteSpace(info,7));
print(Char.IsWhiteSpace(info,8));
print(Char.IsWhiteSpace(info,9));
print(Char.IsWhiteSpace(info,10));
print(Char.IsWhiteSpace(info,11));
string [] split = info.Split();
foreach(string s in split)
print(s);
}
Here's the output:
628 5911.3097 1660.0134 3771.8285 0 False False False True True True True True True False False False 628 (empty) (empty) (empty) (empty) (empty) 5911.3097 (empty) (empty) (empty) (empty) (empty) 1660.0134 (empty) (empty) (empty) (empty) (empty) 3771.8285
It seems to me that System.String.Split(null)
just removed one space for me :S
I'm using: Unity3D, Mono, C#, Mac OSX 10.8