Interview Questions

Tuesday, May 13, 2014

How to restrict numbers in an String

static void RestrictNumbersInString_GK(Args _args)
{
#define.alphabets('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
str     Field1;//is your field
;
Field1 = "kjhhskh01ksdjhf";

if((strkeep(substr(Field1,1,strlen(Field1)),#alphabets)!= substr(Field1,1, strlen(Field1))))
{
    info(strfmt("%1","You cannot enter other than alphabets"));
    }
    else
    {
    info(strfmt("%1",Field1));
    }

}

No comments:

Post a Comment