Determine if a string is numeric: Difference between revisions
Content added Content deleted
m (→{{header|C++}}) |
m (→{{header|REXX}}: aligned comments, made REXX code compliant. -- ~~~~) |
||
Line 1,693: | Line 1,693: | ||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
<lang rexx>/*REXX program to determine if a string is numeric. */ |
|||
<lang REXX> |
|||
yyy=' -123.78' /*or some such.*/ |
yyy=' -123.78' /*or some such.*/ |
||
Line 1,723: | Line 1,723: | ||
/*Note: some REXX interpretors allow use of tab chars as blanks. */ |
/*Note: some REXX interpretors allow use of tab chars as blanks. */ |
||
/*all statements below are equivalent.*/ |
/*all statements below are equivalent.*/ |
||
Line 1,737: | Line 1,736: | ||
if datatype(yyy)¬= 'NUM' then say 'oops, not numeric:' yyy |
if datatype(yyy)¬= 'NUM' then say 'oops, not numeric:' yyy |
||
/*note: REXX only looks at the first char for DATATYPE's 2nd arg.*/ |
/*note: REXX only looks at the first char for DATATYPE's 2nd arg. */ |
||
/*note: some REXX interpretors don't support the ¬ (not) character.*/ |
/*note: some REXX interpretors don't support the ¬ (not) character.*/</lang> |
||
</lang> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |