strip 2+ spaces or more

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
macroman
Pro Scripter
Posts: 91
Joined: Mon Jun 02, 2014 5:32 am

strip 2+ spaces or more

Post by macroman » Thu Nov 03, 2016 11:08 pm

Hello, is there anyway I can do a stringreplace to remove multiple spaces in between words? I have a variable that prints: "test 12 one world ok bye now"

how do I reduce those spaces to just a single space between each words?

Thanks in advance...

hagchr
Automation Wizard
Posts: 331
Joined: Mon Jul 05, 2010 7:53 am
Location: Stockholm, Sweden

Re: strip 2+ spaces or more

Post by hagchr » Fri Nov 04, 2016 8:39 am

To replace one or more spaces with just one space you can eg do:

Code: Select all

Let>text=test 12 one world     ok    bye now
RegEx>%SPACE%+,text,0,m,nm,1,%SPACE%,text
MDL>text

macroman
Pro Scripter
Posts: 91
Joined: Mon Jun 02, 2014 5:32 am

Re: strip 2+ spaces or more

Post by macroman » Fri Nov 04, 2016 11:06 am

awesome, thanks!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts