Okay, so I am working on this VB.NET program and I have tried using the .replace() to do this but it's not the best way to do this. I have a string with multiple spaces in between data which I don't want, what would be the best way to strip the spaces from the string but 1?
Use a regular expression to match multiple spaces and replace with a single space:
s = Regex.Replace(s, " {2,}", " ")
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments