We help IT Professionals succeed at work.

Clear triple or double spaces in string

233 Views
Last Modified: 2014-05-22
I have been performing operations by removing certain words but need to tdy up the string so that only 1 space is between the words
example below. if i do replace and "  " or "   " in some cases it removed the single space that i needed.
Expr1

80
80   CC
80   CL
80   SPECIAL
80  FI
80  QUATTRO
80  SE
80 CC
80 CL
80 CLE
80 E
80 E QUATTRO
80 E SE
80 GL
80 GLE
80 GLS
80 GT
80 GTE
80 L
80 LS
80 QUATTRO
80 QUATTRO FI
80 QUATTRO GTE
80 QUATTRO SE
80 RS2
80 S
80 S2
80 SC
80 SE
80 SPECIAL
80 SPORT
80 SPORT SE
Comment
Watch Question

IT Consultant
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
is this in regex or just replace function?
Dan CraciunIT Consultant
CERTIFIED EXPERT

Commented:
regex

Author

Commented:
got it great thx
Dan CraciunIT Consultant
CERTIFIED EXPERT

Commented:
You're welcome.
Jim Dettman (EE MVE)President / Owner
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2017

Commented:
Other method is:

 Do until Instr(strCheck,"  ")=0
   Replace(strCheck, "  "," ")
 Loop
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.