Removing alphabetic prefixes and suffixes from a string

Here is a small job which can remove all alphabets that appear at the start and at the end of any string. For eg. if we have a string "Sumit12345123Loya" then the string returned from this job would be "12345123". Please note if there are no integers in a string then this job will display only null. Here is the job
static void removeAplhabetic_Prefix_Suffix(Args _args)
    int i = 0;
    int whereFound;
    str myString = "Sumit12345123Loya";
        for(i=0 ; i < strlen(myString); i++)
            whereFound = strnFind(myString, ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’ , 1, strLen(myString));
            if(whereFound > 1)
                myString = strdel(myString,1,1);
        for(i=strlen(myString); i > 0; i–)
            whereFound = strnFind(myString, ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’ ,strLen(myString), -strLen(myString));
            if(whereFound <= strlen(myString)-1)
                myString = strdel(myString,strlen(myString),1);

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s