11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

$ISVALIDNUMmin and maxYou can specify a minimum allowed value, a maximum allowed value, neither, or both. Ifspecified, the num value (after the scale operation) must be greater than or equal to the minvalue, and less than or equal to the max value. A null string as a min or max value is equal tozero. If a value does not meet these criteria, $ISVALIDNUM returns 0.If you omit a parameter, retain the comma as a place holder. For example, when omittingscale and specifying min or max, or when omitting min and specifying max. Trailing commasare ignored.ExamplesIn the following example, each invocation of $ISVALIDNUM returns 1 (valid number):WRITE !,$ISVALIDNUM(0) ; All integers OKWRITE !,$ISVALIDNUM(4.567) ; Decimal numbers OKWRITE !,$ISVALIDNUM("4.567") ; Numeric strings OKWRITE !,$ISVALIDNUM(-.0) ; Signed numbers OKWRITE !,$ISVALIDNUM(+004.500) ; Leading/trailing zeroes OKWRITE !,$ISVALIDNUM(4E2) ; Exponents OKIn the following example, each invocation of $ISVALIDNUM returns 0 (invalid number):WRITE !,$ISVALIDNUM("") ; Null string is invalidWRITE !,$ISVALIDNUM("4,567") ; Commas are not permittedWRITE !,$ISVALIDNUM("4A") ; Invalid characterThe following example shows the use of the min and max parameters. All of the followingreturn 1 (number is valid and also passes the range check):WRITE !,$ISVALIDNUM(4,,3,5) ; scale can be omittedWRITE !,$ISVALIDNUM(4,2,3,5) ; scale can be larger than; number of decimal digitsWRITE !,$ISVALIDNUM(4,0,,5) ; min or max can be omittedWRITE !,$ISVALIDNUM(4,0,4,4) ; min and max are inclusiveWRITE !,$ISVALIDNUM(-4,0,-5,5) ; negative numbersWRITE !,$ISVALIDNUM(4.00,2,04,05) ; leading/trailing zerosWRITE !,$ISVALIDNUM(.4E3,0,3E2,400) ; exponents expandedThe following example shows the use of the scale parameter with min and max. All of thefollowing return 1 (number is valid and also passes the range check):<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 233

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!