To find the last character in a string
string lastCharacter = myString.Substring(myString.Length - 1, 1);
//i.e. the last character is a SubString of myString, one character long, starting one character short of the length of myString
To remove the last two characters of a string
string myNewString = myString.Substring(0, myString.Length - 2);
//i.e. the new string is a SubString 2 characters shorter than myString, starting at the beginning of myString
Showing posts with label find the last character in a string in c#. Show all posts
Showing posts with label find the last character in a string in c#. Show all posts
Saturday, November 14, 2009
Subscribe to:
Posts (Atom)