Hello everyone! Please! check this code. string word="It is a string"; while (word != '\0') { Console.Write(word+"\n"); i++; } It give an unexpected error, after printing all the letters. Can anyone tell me how to remove this error?
So, how can i break this string into characters without error. string word; Console.Write(word+"\n"); Please! Write some code for it.
Could this be what you're looking for: http://msdn.microsoft.com/en-us/library/system.string.substring.aspx
I want to break the string into characters, by using while or For loop, and the loop should stop as the string ends. My Code is breaking the string but it give error in the last. I can also use the condition word.length() but i want to do it as it is done in C++. while (word != '\0')
Try the Substring function o the [] operator but do not loop it like in C. Loop it using the length variable