|
Is there some code like this:
That will allow you to remove the last whole word instead of one character?
(comments are locked)
|
|
This should do it:
Edit: Thanks, but I need the code to be generic so that it removes the last word no matter what the word is. Also, the word might be found more than once in a string and I wouldn't want to remove them all!
Jul 09 '10 at 01:23 PM
Ben
In that case i'm editing the question and then my answer so it makes more sense
Jul 09 '10 at 01:33 PM
Mike 3
LastIndexOf(" "); is just what I was looking for! Thanks
Jul 09 '10 at 09:40 PM
Ben
(comments are locked)
|
|
Given your comment to Mike, here's a solution. Use Remove along with LastIndexOf(" "), to get the index of the last space. We will need more information from you if finding a space isn't a good enough solution for you to find the final word.
(comments are locked)
|
