char.IsWhiteSpace finds space at "wrong" position

Viewed 279

I am working through the book on a sample code but got a bit confused and struggle to find (probably a simple) answer. I wrote the following code:

static void CharFunctionality()
{

    Console.WriteLine("char.IsWhiteSpace('Hello There', 5): {0}", char.IsWhiteSpace("Hello There", 5));
    Console.WriteLine("char.IsWhiteSpace('Hello There', 6): {0}", char.IsWhiteSpace("Hello There", 6));
    Console.WriteLine();
    Console.ReadKey();
}

when I run it I get the following output:

char.IsWhiteSpace('Hello There', 5): True
char.IsWhiteSpace('Hello There', 6): False

I would think that this should be the other way around? the 5th character is 'o' and the 6th is 'space'. I hope someone can point me in the right direction on my journey into the world of development :)

thank you!

3 Answers
Related