Alastair,
 The function is even more versatile since the "pad" char could
be any character.

for example SET VAR vTval = 'aa   bb  cc dd'
 set var vcln = (SPACE(.vTval,5,'='))
 show var vcln
'aa=====bb=====cc=====dd'
or
set var vcln=(space(.vTbal,0))
sho var vcln
'aabbccdd'

Regina REXX is a free implementatin of wrex with source code
available.  I would love to extract out the "SPACE" function
code and convert it to an RBase UDF.  Alas, so many needs, so
little time.

Jim
--- Alastair Burr <[EMAIL PROTECTED]> wrote:

> Hi Jim,
> 
> That's neat - so you can effectively replace a multitude of
> different 
> numbers of spaces with a repetitive number of equal ones with
> that 
> function - if I understand it correctly?
> 
> So for typists with errant fingers you could remove the double
> and triple 
> spaces that some use for no obvious reason?
> 
> What I'm currently doing is examining all my SET VAR commands
> in my RMD/EEP 
> files.
> However, for years, I have set out my files in what I think is
> an easy way 
> to see that each one is defined correctly:
> 
> SET VAR vShort                              TEXT = NULL
> SET VAR vVeryLongNameForVar TEXT = NULL
> SET VAR vInteger                    INTEGER = NULL
> 
> It's those spaces between the name and the type that regularly
> vary.
> 
> Regards,
> Alastair.
> 
> 
> ----- Original Message ----- 
> From: "James Bentley" <[EMAIL PROTECTED]>
> To: "RBASE-L Mailing List" <[email protected]>
> Sent: Sunday, May 04, 2008 9:20 PM
> Subject: [RBASE-L] - Re: Removing multiple spaces from a
> string
> 
> 
> > Alastair,
> >
> > My favorite command language REXX has a marvelous function:
> > SPACE(string,n,pad)
> > Formats the blank-delimited words in "string" with n "pad:
> > characters between each word.
> >
> > for example SET VAR vTval = 'aa   bb  cc dd'
> > set var vcln = (SPACE(.vTval,1,' '))
> > show var vcln
> > 'aa bb cc dd'
> >
> > Jim Bentley
> >
> > --- Alastair Burr <[EMAIL PROTECTED]> wrote:
> >
> >> ----------------------------I don't know why this appeared
> for
> >> a second time - I didn't re-send it intentionally - so
> >> apologies all round.
> >>
> >> However, it gives me the opportunity to reply to Ben, Mike
> &
> >> Larry:
> >>
> >> Thanks for your responses.
> >>
> >> I prefer the while loop to my goto so that's an improvement
> -
> >> thanks Ben & Larry.
> >>
> >> I looked at the SSTRIP(I) functions when I was searching
> for a
> >> function that I was sure must exist to do what I wanted. I
> >> concluded that I could take out all the spaces but that
> >> wouldn't leave me a way to use SSUB. Thanks Mike, if I'm
> >> missing a way to do what I want with it please let me know.
> >>
> >> I had already discovered the problem with SLOC and double
> >> spaces after I posted originally and before Larry's
> comments.
> >> I'd got around it by replacing all spaces with a | and then
> >> getting rid of the double ones - much as suggested.
> >>
> >> It seems obvious to ask why SLOC has a problem identifying
> two
> >> spaces? Is it an R:Base problem or a Windows/general
> computing
> >> one? IF it's an R:Base one does it need reporting or is
> RBTI
> >> aware already?
> >>
> >> Also, is there a need for a function that can take out the
> >> words from a string regardless of the number of spaces
> between
> >> them? A sort of "Super-SLOC" that, perhaps, works on any
> >> number of spaces rather than the comma (or whatever the
> >> delimit is set to)?
> >>
> >> Regards,
> >> Alastair.
> >>
> >>
> >>   ----- Original Message ----- 
> >>   From: Alastair Burr
> >>   To: RBASE-L Mailing List
> >>   Sent: Saturday, May 03, 2008 8:31 AM
> >>   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]
> >>
> >>   -----------------------------
> >>
> >>
> >>
> >>
> >>
> >>
> >
>
------------------------------------------------------------------------------
> >>
> >>
> >>   No virus found in this incoming message.
> >>   Checked by AVG.
> >>   Version: 7.5.524 / Virus Database: 269.23.8/1412 -
> Release
> >> Date: 02/05/2008 16:34
> >>
> >
> >
> > Jim Bentley
> > American Celiac Society
> > [EMAIL PROTECTED]
> > tel: 1-504-737-3293
> >
> >
> > 
> >
>
____________________________________________________________________________________
> > Be a better friend, newshound, and
> > know-it-all with Yahoo! Mobile.  Try it now. 
> > http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> >
> >
> >
> >
> > -- 
> > No virus found in this incoming message.
> > Checked by AVG.
> > Version: 7.5.524 / Virus Database: 269.23.8/1413 - Release
> Date: 
> > 03/05/2008 11:22
> >
> > 
> 
> 
> 
=== message truncated ===


Jim Bentley
American Celiac Society
[EMAIL PROTECTED]
tel: 1-504-737-3293


      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


Reply via email to