substring last 4 characters code example
Example 1: how to select last 2 elements in a string python
>>>mystr = "abcdefghijkl"
>>>mystr[-4:]
'ijkl'
>>>mystr[:-4] #to select all but last 4 characters
'abcdefgh'
Example 2: last two characters of string c#
string str = "Hello World";
string substr = str.Substring(str.Length - 2);