Delete spaces after end of string containing two words VB.NET 2005
Posted on 2007-07-24
I would like to take a string and if it has two words in it, I would like to strip any spaces that occur at the end of the string (something like a "trim right"). However, if it is only one word, then I would like to leave a single space after the word, if the user entered it, and get rid of anything else which occurs after. For example:
"Hello, world " gets converted to "Hello, world"
"Hello " gets converted to "Hello "
How do I do this in VB.NET 2005?