Suppose I have a string:
\"34234234d124\"
I want to get the last four characters of this string which is \"d124\". I can use <
\"d124\"
Definition:
public static string GetLast(string source, int last) { return last >= source.Length ? source : source.Substring(source.Length - last); }
Usage:
GetLast("string of", 2);
Result:
of