c# select first n of string code example
Example 1: c# get first 5 characters of string
string result = str.Substring(0,5);
Example 2: get first number in string C#
var input = "12985bwevgjb9812";
string firstDigit = new String(input.TakeWhile(Char.IsDigit).ToArray());