PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → WB21 - Remove All Spaces
WB21 - Remove All Spaces
Iniciado por guest, 10,sep. 2017 11:23 - 5 respuestas
Publicado el 10,septiembre 2017 - 11:23
Hi All

Hoping there is a simple solution to this. Is there a function to remove all spaces in a string? ccIgnoreInsideSpace is not available in WB. I have tried Replace - replacing " " with "" seems not to work.

Any idea how to do this?

Cheers
André
Publicado el 10,septiembre 2017 - 13:25
Hi André

REPLACE is the solution. If your code doesn't work, it's either because you made a mistake in it, or there is something you are not telling us.

Best regards
Publicado el 10,septiembre 2017 - 13:40
Hi André,

I thought the replace function had a strip functionality indeed since V19 or so... Haven't looked at it, but I find it extremely weird (worrying) that the behaviour os such a basic function would be different between the three products so maybe you overlooked something.

Anyway the first very old post on the PCSoft repository is mine and provides a class to do string management functions that were not available at the time (V14 or V15 I believe) in the standard products. There is a strip method available in there that does what you need.

Cheers,

Peter Holemans
Publicado el 10,septiembre 2017 - 22:34
Thanks Peter and Fabrice - got it sorted. A stupid mistake on my part. I was not assigning the result to a new string.

Cheers
André
Publicado el 11,septiembre 2017 - 18:59
You can also do the following:

sYourStringWithSpaces is string = "Hello I have spaces"
sYourStringWithoutSpaces is string = NoSpace(sYourStringWithSpaces)

I guess replace also works, but just so you know this other function.
Publicado el 11,septiembre 2017 - 20:20
NoSpace(sYourStringWithSpaces, sscInside) = "HelloIhavespaces" You need to tell it which spaces to remove to avoid the 'outside' default.
Works on all WD products.