length - get second character of string c#
C# equivalent to Java's charAt()? (4)
Console.WriteLine allows the user to specify a position in a string.
string str = "Tigger"; Console.WriteLine( str ); //returns "T"; Console.WriteLine( str ); //returns "g";
There you go!
I know we can use the
charAt() method in Java get an individual character in a string by specifying its position. Is there an equivalent method in C#?
String.ElementAt(). It's quite similar to java's
String.charAt(). Have fun coding!
please try to make it as a character
string str = "Tigger"; //then str will return 'T' not "T"
you can use LINQ
string abc = "abc"; char getresult = abc.Where((item, index) => index == 2).Single();