PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD20] - Removing double spaces
[WD20] - Removing double spaces
Iniciado por guest, 29,dic. 2015 13:55 - 4 respuestas
Publicado el 29,diciembre 2015 - 13:55
Hi All

I'm sure I have solved this before but having a blind moment - how to remove all double spaces in a block of text and replace to a single space?

Replace() function does not allow the replacement string to be a blank - From help...

String to Replace: Character string (with quotes) Character string that must be replaced in the initial string.If this parameter corresponds to an empty string (""), Result will correspond to Initial String.

Any suggestions?
Publicado el 29,diciembre 2015 - 14:10
Hi,

What about:

sResult = Replace (String1,caract(32)+caract(32),caract(32))

Cheers
Tor-Bjarne
Publicado el 29,diciembre 2015 - 14:24
Hi JP

I tried using x=Replace(x," "," ") where x is a string with a couple of double spaces and it worked.

The second parameter (String to replace) is two spaces.
The third parameter (New string) is a single space.

The holidays must be getting to you. :)

- Mike H.
Publicado el 29,diciembre 2015 - 14:32
Mike

You're right - it does work. I must indeed be having holiday blindness :) Thanks for confirming.
Publicado el 29,diciembre 2015 - 14:33
Tor-Bjarne - thanks - I was not seeing it, and the help threw me, but it does work after all. Sorry!