C#: how to get first char of a string?
Try this,
string s1="good";
string s=s1.Substring(0,1);
Just MyString[0]
. This uses the String.Chars indexer.
Mystring[0]
should be enough
Try this,
string s1="good";
string s=s1.Substring(0,1);
Just MyString[0]
. This uses the String.Chars indexer.
Mystring[0]
should be enough