Vb.net – Get last 5 characters in a string

vb.net

I want to get the last 5 digits/characters from a string. For example, from "I will be going to school in 2011!", I would like to get "2011!".

Any ideas? I know Visual Basic has Right(string, 5); this didn't work for me and gave me an error.

Best Answer

str.Substring(str.Length - 5)
Related Topic