Replacing multiple spaces with one space

Hello,

Text in a TextArea may have several spaces of varying lengths in several locations, how can all of them be replaced with only one space when they occur?

Thanks.

Lennox

while instr(textarea1.text, " “) > 0 // this is 2 spaces in quotes
textarea1.text = textarea1.text.replaceall(” ", " " ) // two space follows by 1 space in quotes
wend

Thanks Norman, works great!

while instr(TheString, "  ") > 0 // this is 2 spaces in quotes
  TheString = TheString.replaceall("  ", " " ) // two space follows by 1 space in quotes
wend

Lennox

I’d have used a regular expression…

Actually, if you have either my M_String or StringUtils, look for the Squeeze function.

Of course you would :stuck_out_tongue:

I just beat you to it by 40+ minutes :stuck_out_tongue: