There are several ways to approach this.
One way is to "parse" the input.You walk through the string in a loop.
If the loop body encouters a quote it toggles a quote flag. If it encounters a space and the quote flag is not on, it removes the space.
Another way, as Alundra, suggested, is to search for the quotes.
You search for the first quote starting at position 0. You can then use replace to remove all space from the string before that. Then you search for the next quote using the other's position +1 as a start. You append that substring directly into the result. Then you repeat with the remaining input string.
Cheers,
_
Bookmarks