How do I get the rightmost part of a string, as with the VB Right function?
Use String.Substring. Assuming that x is a string of length at least
n, to get the last n characters, you would use x.Substring(x.Length-n).
Note that the above assumes that the string is at least n characters long. For a more robust version,
you might use something like: x.Length < n ? x.Substring(x.Length-n) : x.
[Author: Jon Skeet]
Comment Notification
If you would like to receive an email when updates are made to this post, please register here
Subscribe to this post's comments using