Per my earlier message obviously you are using SRPL.  I wrote too soon on
that one!  Must get more coffee!!

 

Mike Ramsour 
AK Steel Coshocton Works 
Quality Department 

Phone/VMS:  740-829-4340 

  _____  

From: Alastair Burr [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 03, 2008 3:32 AM
To: [email protected]
Subject: [RBASE-L] - Removing multiple spaces from a string

 

I am trying to remove all double spaces in text in order to replace the
remaining single spaces with a comma so that I can use SSUB on the converted
string.

 

The target string (vVarData) may have an unknown number of spaces between
the words. There's no pattern from one string to another. In theory there's
no limit to the length of any space although, in practice, it's likely only
to be a few space "characters".

 

I expected to be able to come up with something rather more eloquent than
this:

 

SET VAR vVarData = (TRIM(.vVarData))

LABEL lSpaces

  SET VAR vCount = 0

  SET VAR vCount = (SLOC(.vVarData, '  '))

  IF vCount <> 0 THEN

    SET VAR vVarData = (SRPL(.vVarData, '  ', ' ', 0))

    GOTO lSpaces

    ENDIF

SET VAR vVarData = (SRPL(.vVarData, ' ', ',', 0))

SET VAR vWord3 = (SSUB(.vVarData, 3))

SET VAR vWord4 = (SSUB(.vVarData, 4))

SET VAR vWord6 = (SSUB(.vVarData, 6))

 

Am I missing a more obvious method to get the end result?

 

Regards,

Alastair

 

----------------------------

Alastair Burr

St. Albans, UK.

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

-----------------------------

 

Reply via email to