WB21 - Remove All Spaces

Startbeitrag von André Labuschagné am 10.09.2017 09: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é

Antworten:

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

von Fabrice Harari - am 10.09.2017 11:25
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

von Peter Holemans - am 10.09.2017 11:40
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é

von André Labuschagné - am 10.09.2017 20:34
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.

von Luis Antonio Gutiérrez Flores - am 11.09.2017 16:59
NoSpace(sYourStringWithSpaces, sscInside) = "HelloIhavespaces"

You need to tell it which spaces to remove to avoid the 'outside' default.
Works on all WD products.

von DerekT - am 11.09.2017 18:20
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.