How to trim " a b c " into "a b c"
.net, algorithm, c#
Solution
You could use `Regex` for this:
Regex.Replace(my_string, @"\s+", " ").Trim();
Problem
Possible Duplicate: How do I replace multiple spaces with a single space in C#? What is the most elegant way how to trim whitespace in strings like `" a<many spaces>b c "` into `"a b c"`. So, repeated whitespace is shrunk into one space.