+ 1

How to divide string to array of chars?

For example: string userInput = Console.ReadLine(); //let userInput be "abcde" char [] example = func(userInput); Console.WriteLine(example[3]); // should output d

17th Jun 2016, 6:33 PM
Mitiko
Mitiko - avatar
3 ответов
+ 1
thanks both are exactly what I'm looking for
18th Jun 2016, 2:10 AM
Mitiko
Mitiko - avatar
0
char[] example = userInput.ToCharArray(); I think that's what you need.
17th Jun 2016, 7:21 PM
erwinmesi
erwinmesi - avatar
0
A string is already an array of Chars: string hey = Console.ReadLine(); Console.WriteLine(hey[2]); if I type "What's up", the output would "a". Is this what you was looking for?
17th Jun 2016, 7:44 PM
Malachi Jones
Malachi Jones - avatar