Get the last four characters off a String?

I want to take any String and be able to remove everything except the last four letters. Is it possible to do that? I’ve looked at String.Split and Trim, but I don’t fully understand how to use them with my situation. Any help?

Look at the documentation

1 Answer

1

string s1 = “read the docs”;
string s2 = s1.Substring(s1.Length - 4); // s2==“docs”;