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
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment