How can I ask if a alfanumeric variable is UPPERCASE or LOWERCASE ?
Thanks for the Help. :?:
How can I ask if a alfanumeric variable is UPPERCASE or LOWERCASE ?
Thanks for the Help. :?:
How about:
move field to hold
examine hold and translate into upper
if field = hold
/* field is upper case
...
end-if
Thanks a lot for the tip Jerome !!!
Use the MASK operand:
if field = MASK(UUUU)
then write 'uppercase'
end-if
if field = MASK(NNNN)
then write 'numbers'
end-if
If you just want to verify if it is numeric, suitable for use in an INPUT statement or VAL function, use
if field is (n5)
#num := val(field)
end-if
The uppercase mask works unless there are blanks in the variable.
mbrossi, the best way to find out how something works, after reading the Natural manual, is to try it for yourself in an ad-hoc program, likeā¦
DEFINE DATA LOCAL
1 #A (A6)
END-DEFINE
*
MOVE 'ABC DE' TO #A
REPEAT
INPUT #A (AD=MI'_')
IF #A = ' '
STOP
END-IF
IF #A = MASK (UUUUUU)
WRITE 'UPPER CASE'
ELSE
WRITE 'NOT UPPER CASE'
END-IF
END-REPEAT
END
Happy coding!