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.

leading and trailing zeros, and deletes a decimal indicator character if it is not followedby any non-zero digits.5. $NUMBER uses the rounding factor (if present) to round the number the specifiednumber of digits. It then strips off any leading or trailing zeros and the decimal indicatorcharacter if it is not followed by any digits.6. $NUMBER validates the number against the minimum value, if specified.7. $NUMBER validates the number against the maximum value, if specified.8. $NUMBER returns the resulting number.European and American Decimal Separators$NUMBER returns a number in canonical form, removing all numeric group separators andincludes at most one decimal separator character. You can use the format values “,” or “.” toidentify the decimal separator used in num; by specifying the decimal separator, you are alsoimplicitly specifying the numeric group separator. In following examples, a comma is specifiedas the decimal separator:SET num="123,456"WRITE !,$NUMBER(num,",")// converts to the decimal number "123.456"// (comma is identified as decimal separator)SET num="123,45,6"WRITE !,$NUMBER(num,",")// returns the null string// (invalid number, too many decimal separators)SET num="123.456"WRITE !,$NUMBER(num,",")// converts to the integer "123456"// removing group separator// (if comma is decimal, then period is group separator)SET num="123.4.56"WRITE !,$NUMBER(num,",")// converts to the integer "123456"// removing group separators// (number and placement of group separators ignored)See Also• $FNUMBER function• $INUMBER function• $ISVALIDNUM function• $NORMALIZE function• More information on locales in Customized National Language Translations$NUMBER<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 275

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

Saved successfully!

Ooh no, something went wrong!