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