× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



From: "Art Tostaine, Jr." <artjr@link400.com>
To: <rpg400-l@midrange.com>
Subject: Find all occurences of alpha characters in a string
Date: Tue, 5 Feb 2002 09:09:11 -0500
Reply-To: rpg400-l@midrange.com
Art wrote:
>I have a field that I am trying to seperate into alpha and numeric.
>
>Examples would be:
>
>"C 123456"
>"1234567C'
>"C1  12345678"
>"C123456"
>
>I want any alpha's in one field and any numerics in another alpha
>field.  I will use Barbara's GETNUM to convert the numeric portion
>to a real number later.
>
>What's the best way to do this?

This looks like a job for regular expressions.  Check this link
<http://www.mcpressonline.com/mc?128@66.QHbZauGuiGY^8@.3d778947>
for a discussion of calling functions "regexec()" and "regcomp()"
from RPG programs, including an example of the use of these
functions.  It's not the easiest thing to code (at least in
languages like RPG or C), but regular expressions offer a great
deal of power in the areas of string matching and extraction.

Cheers!  Hans

Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.