Haha, I found it.
First of all, there is nothing wrong with both of your codes. Both work great. Only your lines are not equal. There are several hidden characters on your second.
Your first "August 11, 2013, 11:00:00 PM".Lenth - 28
but the second one is "August 11, 2013, 11:00:00 PM".Lengt is 33
Try this code:
string s = "August 11, 2013, 11:00:00 PM"; string s1 = "August 11, 2013, 11:00:00 PM"; char[] c = s.ToCharArray(); char[] c1 = s1.ToCharArray(); foreach (var ch in c) { Console.WriteLine(ch); } foreach (var ch1 in c1) { Console.WriteLine(ch1); }
The output will be:
A u g u s t 1 1 , 2 0 1 3 , 1 1 : 0 0 : 0 0 P M ?
As a solution, do not copy any line to the line :).
source share