Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I validate parameter input

Status
Not open for further replies.

Tison

Programmer
May 12, 1999
216
CH
I want to validate this input (year comma month) ;
2004,06
and the validation must check for valid year 1999 - 2010
must check for a comma
must check for valid month 01-12
 
finally an appropriate case for awk,

...
split($1,arr,",");
arr[0] += 0; #ensure integer interpretation
arr[1] += 0; #ensure integer interpretation
if(arr[0] >2010 || 1999 >arr[0]) exit(1);
if(arr[1] >12 || 1 >arr[1]) exit(1);
#do the rest
exit(0);
...

:) guggach
 
And to validate the comma (format of parm is specific) ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top