What is the Best Way to Reduce Several Plain Spaces

Suppose you have a word file and it is translated to raw an Excel export or Text by a robot system. The file had tabs or indentations and you have put white spaces in those spots.

Now these white spaces need to be reduced into a single space. Here is an example:

From: This…is…a…test.

To: This is a test.

You have a simple way and that is to use Regex.

Here is a Regex operation in the following which eliminates multiple spaces and creates a single space.

<p>myString = Regex.Replace(myString, "\s+", "
")</p>