Hi,
I seek your help in designing a RPG /RPGLE program which will identify the series of numbers among the character string (like phone #s, Credit card number, etc..)
Ex: If String A = 'ABCDSSS123456DDB7BB' My result field should only fetch '123456' and not '7'. (in this example '7' is not among series).
Can someone enlighten ?
Software/Hardware used:
RPG/400 , ILE
ASKED:
February 10, 2012 10:06 PM
UPDATED:
March 17, 2012 5:28 AM
Phone numbers, credit card numbers and others are often entered with special characters like ’555-1234′. What controls are in place to limit what your program might run into?
Tom
Sounds like you want to:
1. find the position of the first digit in the string
2, Then find the first non-digit
3. Then extract the substing bounded by those positions.
Hope this helps
Also, how long can the “strings” be? If these are basic string values 100 or 200 bytes or so long, it might be very different from handling a 16MB XML document or something like that.
Tom
Philip,
Thanks for your response. I will work towards your suggestion.
Tom,
In my case, I am limiting the user from entering sensitive data in comments / notes section. Hence we may get any thing !!!. But we are limiting the program to read series of numerals (a.ka credit card – 16 digits / ph number 10 digits) ..
Regards
Kannan
(in this example ’7′ is not among series)
Does that simply mean that ’7′ is just a single digit, so it can be ignored?
And again, how long are the strings? A basic estimate to get an idea about efficient techniques is needed.
Tom
And, can a string have more than one series?
Tom
%CHECK() is your friend. Use it to determine the start of your sequence(s).
From there you can determine what to do.