[Stackoverflow] [Progress OpenEdge ABL] How can I determine if a character is alpha?

Status
Not open for further replies.
F

Felice

Guest
I have a list of phone numbers that sometimes have a person in parenthesis at the end. I need to extract the person's name (and add that as a note in a separate field). Here is an example of the data:

Code:
(517)234-6789(Bob)
701-556-2345
(325)663-5977
(215)789-8585
425-557-7745(Pauline)

There is always a () around the person's name, but often there is also a () around the area code, so I can't use the ( as a way to know a name has started. I'd like to create a loop that goes through the phone number string and if it sees alpha characters, builds a string that will be assigned to a variable as the name.

Something like this. I am making up the IS-ALPHA syntax, of course. That is what I am looking for, or something where I don't have to list every letter.

Code:
PROCEDURE CreatePhoneNote (INPUT cPhone AS CHARACTER)
    DEFINE VARIABLE cPersonName AS CHARACTER NO-UNDO.
    DEFINE VARIABLE cThisChar AS CHARACTER NO-UNDO.
    DEFINE VARIABLE iCount AS INTEGER NO-UNDO.

    DO iCount 1 TO LENGTH(cPhone):
        cThisChar = SUBSTRING(cPhone,iCount,1).
        IF IS_ALPHA(cThisChar) THEN cPersonName = cPersonName + cThisChar.
    END.
    
    //etc.....
   
END PROCEDURE.

Continue reading...
 
Status
Not open for further replies.
Top