c# get last 4 characters of string code example
Example 1: c# get last character of string
string str = "Hello World";
string substr = str.Substring(str.Length - 1);
Example 2: c# get last two characters of string
var result = str.Substring(str.Length - 2);
Example 3: get last character of string c#
str = str.Substring(str.Length - 1);
Example 4: last two characters of string c#
string str = "Hello World";
string substr = str.Substring(str.Length - 2);