SCOUG Logo


Next Meeting: Sat, TBD
Meeting Directions


Be a Member
Join SCOUG

Navigation:


Help with Searching

20 Most Recent Documents
Search Archives
Index by date, title, author, category.


Features:

Mr. Know-It-All
Ink
Download!










SCOUG:

Home

Email Lists

SIGs (Internet, General Interest, Programming, Network, more..)

Online Chats

Business

Past Presentations

Credits

Submissions

Contact SCOUG

Copyright SCOUG



warp expowest
Pictures from Sept. 1999

The views expressed in articles on this site are those of their authors.

warptech
SCOUG was there!


Copyright 1998-2024, Southern California OS/2 User Group. ALL RIGHTS RESERVED.

SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group. OS/2, Workplace Shell, and IBM are registered trademarks of International Business Machines Corporation. All other trademarks remain the property of their respective owners.

The Southern California OS/2 User Group
USA

SCOUG-Programming Mailing List Archives

Return to [ 17 | September | 1998 ]

<< Previous Message <<


Date: Thu, 17 Sep 1998 20:34:07 PDT
From: Peter Skye <pskye@peterskye.com >
Reply-To: scoug-programming@scoug.com
To: scoug-programming@scoug.com
Subject: SCOUG-Programming: Calling all REXX programmings

Content Type: text/plain

> > Is there a clean way to collect all of the
> > numeric data from a string. For example, given:
> > abc123def456ghi
> > I want
> > 123456

I should have also mentioned that, if you want to eliminate _every_
character except 0..9, use XRANGE() to generate your inline string.

For ASCII display characters:

st = 'abc123def456ghi'
say space( translate( st, '', xrange(' ','/') || xrange(':','~')),
0)

or, for all binary characters,

st = 'abc123def456ghi'
say space( translate( st, '', xrange('00'x,'2f'x) ||
xrange('3a'x,'ff'x)), 0)

How it works: XRANGE() generates a string of characters
('abcdefghij...') that you don't want. The concatenation ("||") puts
the XRANGE() character strings together. Then TRANSLATE() replaces
those characters with spaces. Finally, SPACE(,0) removes all the
spaces.

It looks terrifying, but it's faster than a Rexx loop. If you're
concerned about readability, the following is the same code but
unrolled, and is also faster than a Rexx loop:

st = 'abc123def456ghi'
/* Generate string of unwanted characters. */
st1 = xrange('00'x,'2f'x) || xrange('3a'x,'ff'x)
/* Replace unwanted characters with spaces. */
st2 = translate( st, '', st1)
/* Remove all spaces. */
say space( st2, 0)

- Perfesser Pete

=====================================================

To unsubscribe from this list, send an email message
to "steward@scoug.com". In the body of the message,
put the command "unsubscribe scoug-programming".

For problems, contact the list owner at
"rollin@scoug.com".

=====================================================


<< Previous Message <<

Return to [ 17 | September | 1998 ]



The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA

Copyright 2001 the Southern California OS/2 User Group. ALL RIGHTS RESERVED.

SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group. OS/2, Workplace Shell, and IBM are registered trademarks of International Business Machines Corporation. All other trademarks remain the property of their respective owners.