c# get everything before last 5 letters string code example Example: c# get last 3 characters of string var result = input.Substring(input.Length - 3);