Tuesday, November 16, 2010

To allow only alphabets to be entered into a string field


This code validates a string field. If you want only the alphabets need to be entered into it.
You can extend this numbers and combination of alphabets and numbers.

static void allowalpha(Args _args)
{
#define.alphabets('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
str k ="kranthi";;
;

if((strkeep(substr(k, 1, strlen(k)), #alphabets) != substr(k, 1, strlen(k))))
print "The string contains other than alphabets";
else
print "The string contains only alphabets";
pause;

}

No comments:

Post a Comment