get first character of string c# code example
Example 1: c# get first 5 characters of string
string result = str.Substring(0,5);
Example 2: c# get certain character from string
string myString = "string";
// outputs r
print(mystring[2]);
Example 3: get first number in string C#
var input = "12985bwevgjb9812";
string firstDigit = new String(input.TakeWhile(Char.IsDigit).ToArray());