Here is another way:

SET VAR loopcount INTEGER = 0
SET VAR vcount INTEGER = 0
WHILE loopcount <  1000 THEN
  SET VAR loopcount = (.loopcount+1)
  SELECT COUNT(*) INTO vcount FROM sometable +
  WHERE (SLOC(somecolumn,'  '))<>0                --two spaces
  IF vcount <> 0 THEN
    UPDATE sometable SET somecolumn = (SRPL(somecolumn,'  ',' ',0))
  ELSE
    BREAK
  ENDIF
ENDWHILE

On Thu, Jan 16, 2020 at 4:56 PM 'Karen Tellef' via RBASE-L <
[email protected]> wrote:

> At one time, the ''  didn't work with SRPL.  I remember that whenever it
> was introduced I knew immediately that I could use that!
>
> Karen
>
>
>
> -----Original Message-----
> From: mike.ramsour <[email protected]>
> To: rbase-l <[email protected]>
> Sent: Thu, Jan 16, 2020 3:34 pm
> Subject: Re: [EXT] Re: [RBASE-L] - Removing embedded spaces from a text
> string
>
> Just a follow-up to the previous.
>
> I tried the suggested approach and it worked very well.  I did one pass
> through the data looking for 5 spaces and then did one more pass looking
> for 2 spaces.
>
> Command example:  UPDATE TEST_TABLE SET NEW_COMMENTS = (SRPL(COMMENTS,'
>   ','',0)) WHERE COMMENTS LIKE '%     %'
>
> Problem solved.
>
> Thank you so much.
>
>
> Mike Ramsour
> AK Steel Coshocton Works
> Quality Department
> Phone:  740-829-4340
> Cell:  740-502-1659
>
>
>
> From:        "'Karen Tellef' via RBASE-L" <[email protected]>
> To:        [email protected]
> Date:        01/16/2020 04:16 PM
> Subject:        [EXT] Re: [RBASE-L] - Removing embedded spaces from a
> text string
> ------------------------------
>
>
>
> You can't get SRPL to work? This is what I would do:
>
> set var vtext2 = (SRPL(.vtext, '     ', '', 0))
>
> What that is:  the first part in the quotes I just spaced 5 times.  The
> second part is just two single quotes together with nothing between.
>
> I've done this before with an UPDATE command.  Create another column to
> hold the result and do repeated UPDATEs until there's no more values with
> the extra spaces.  Of course you'd have to have an idea of how many UPDATEs
> you would need to take care of the extra spaces.
>
>
> Karen
>
>
>
>
> -----Original Message-----
> From: mike.ramsour <[email protected]>
> To: rbase-l <[email protected]>
> Sent: Thu, Jan 16, 2020 1:03 pm
> Subject: [RBASE-L] - Removing embedded spaces from a text string
>
> Good afternoon:
>
> What's the best way to remove embedded spaces from text strings?
>
> I have a column named COMMENTS that contains text prose similar to this:
>
> 'COLD MILL CHATTER                                VERY LITE'
>
> I want to remove any occurrence of 2 or more spaces in a row so that I end
> up with a value like this:
>
> 'COLD MILL CHATTER VERY LITE'
>
> I have experimented with the various TRIM functions as well as SRPL but
> have not had any success yet.
>
> I'm looking for the same functionality as the TRIM () function in Excel.
>
> Any help is greatly appreciated.
>
> Best regards.
>
> Mike Ramsour
> AK Steel Coshocton Works
> Quality Department
> Phone:  740-829-4340
> Cell:  740-502-1659
> Confidentiality Notice
> This message is intended exclusively for the individual or entity to which
> it is addressed and may contain privileged, proprietary, or otherwise
> private information.
> If you are not the named addressee, you are not authorized to read, print,
> retain, copy or disseminate this message or any part of it. If you have
> received this message in error, please notify the sender immediately by
> e-mail and delete all copies of the message.
> --
> For group guidelines, visit
> *http://www.rbase.com/support/usersgroup_guidelines.php*
> <http://www.rbase.com/support/usersgroup_guidelines.php>
> ---
> You received this message because you are subscribed to the Google Groups
> "RBASE-L" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to *[email protected]*
> <[email protected]>.
> To view this discussion on the web visit
> *https://groups.google.com/d/msgid/rbase-l/OF633DC4EF.8B6FCEE6-ON852584F1.0067DC43-852584F1.0068B53F%40aksteel.com*
> <https://groups.google.com/d/msgid/rbase-l/OF633DC4EF.8B6FCEE6-ON852584F1.0067DC43-852584F1.0068B53F%40aksteel.com?utm_medium=email&utm_source=footer>
> .
> --
> For group guidelines, visit
> *http://www.rbase.com/support/usersgroup_guidelines.php*
> <http://www.rbase.com/support/usersgroup_guidelines.php>
> ---
> You received this message because you are subscribed to the Google Groups
> "RBASE-L" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to *[email protected]*
> <[email protected]>.
> To view this discussion on the web visit
> *https://groups.google.com/d/msgid/rbase-l/372186748.14679710.1579209383931%40mail.yahoo.com*
> <https://groups.google.com/d/msgid/rbase-l/372186748.14679710.1579209383931%40mail.yahoo.com?utm_medium=email&utm_source=footer>
> .
>
> Confidentiality Notice
> This message is intended exclusively for the individual or entity to which
> it is addressed and may contain privileged, proprietary, or otherwise
> private information.
> If you are not the named addressee, you are not authorized to read, print,
> retain, copy or disseminate this message or any part of it. If you have
> received this message in error, please notify the sender immediately by
> e-mail and delete all copies of the message.
> --
> For group guidelines, visit
> http://www.rbase.com/support/usersgroup_guidelines.php
> ---
> You received this message because you are subscribed to the Google Groups
> "RBASE-L" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
>
> https://groups.google.com/d/msgid/rbase-l/OFF5BE31CD.AF3259B0-ON852584F1.00761AAB-852584F1.00768150%40aksteel.com
> <https://groups.google.com/d/msgid/rbase-l/OFF5BE31CD.AF3259B0-ON852584F1.00761AAB-852584F1.00768150%40aksteel.com?utm_medium=email&utm_source=footer>
> .
>
> --
> For group guidelines, visit
> http://www.rbase.com/support/usersgroup_guidelines.php
> ---
> You received this message because you are subscribed to the Google Groups
> "RBASE-L" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rbase-l/173767968.14696081.1579211762564%40mail.yahoo.com
> <https://groups.google.com/d/msgid/rbase-l/173767968.14696081.1579211762564%40mail.yahoo.com?utm_medium=email&utm_source=footer>
> .
>

-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/CADeqk-7xdckqOu4AEHNa7J4PF2_DFViFc%3Dj6Fa7RUwvN6p6x2A%40mail.gmail.com.

Reply via email to