IsNumeric: Difference between revisions
From Catglobe Wiki
More actions
jrfconvert import  |
No edit summary  |
||
| (2 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
{{HelpFiles}} | |||
 | |||
====isNumeric==== | ==== isNumeric ==== | ||
Checks if the value of a specific parameter can be converted to a number. | Checks if the value of a specific parameter can be converted to a number. Â | ||
'''Syntax''' | '''Syntax''' Â | ||
isNumeric(expression) | isNumeric(expression) Â | ||
'''Arguments''' | '''Arguments''' Â | ||
expression: Is an expression of any types defined | expression: Is an expression of any types defined  | ||
'''Return type''' | '''Return type''' Â | ||
bool | bool  | ||
'''Examples''' | '''Examples''' Â | ||
'' | ''string a = "1";'' Â | ||
'' | ''if (isNumeric(a)) print("The value of a can be converted to a number"); '' Â | ||
'' | ''else print("The value of a cannot be converted to a number");'' Â | ||
'' | ''//Result: The value of a can be converted to a number'' Â | ||
'' | ''//------------------------------'' Â | ||
Version 4.8 | ''string b = "Where do you go?";'' | ||
__NOTOC__ | Â | ||
<!-- imported from file: 417.htm--> | ''if (isNumeric(b)) print("The value of b can be converted to a number");'' | ||
 | |||
''else print("The value of b cannot be converted to a number"); '' | |||
 | |||
''//Result: The value of b cannot be converted to a number'' | |||
 | |||
'''Availability''' | |||
 | |||
Version 4.8 __NOTOC__ <!-- imported from file: 417.htm--> Â | |||
 | |||
[[Category:General_Functions]] | |||
Latest revision as of 03:53, 22 December 2011

isNumeric
Checks if the value of a specific parameter can be converted to a number.
Syntax
isNumeric(expression)
Arguments
expression: Is an expression of any types defined
Return type
bool
Examples
string a = "1";
if (isNumeric(a)) print("The value of a can be converted to a number");
else print("The value of a cannot be converted to a number");
//Result: The value of a can be converted to a number
//------------------------------
string b = "Where do you go?";
if (isNumeric(b)) print("The value of b can be converted to a number");
else print("The value of b cannot be converted to a number");
//Result: The value of b cannot be converted to a number
Availability
Version 4.8