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.

<strong>Caché</strong> <strong>ObjectScript</strong> FunctionsNotesOrder of Operations$NUMBER performs the following series of conversions and validations. If the number failsany validation step, $NUMBER returns a null string (""). If the number passes all validationsteps, $NUMBER returns the resulting converted <strong>Caché</strong> canonical form number.1. $NUMBER uses the decimal character format to determine which character is the groupseparator and strips out all group separator characters (regardless of location in thenumber). It uses the following rule: If the decimal character specified in format is a period(.), then the group separator is a comma (,) or apostrophe ('). If the decimal characterspecified in format is a comma (,), then the group separator is a period (.) or apostrophe('). If no decimal character is specified in format, the group separator is the Numeric-GroupSeparator property of the current locale.2. $NUMBER validates that the number is well-formed. A well-formed number can containany of the following:• Numbers• An optional decimal indicator character, as defined above (one or none, but not morethan one).• An optional plus (+) or minus (-) sign character (leading or trailing, but not morethan one).• Optional parentheses enclosing the number to indicate a negative value (debit). Thenumber within the parentheses cannot have a sign character.• An optional exponent, indicated by an “E” (uppercase or lowercase) followed by aninteger. If “E” is specified, an exponent integer must be present. The exponent integermay be preceded by a sign character.3. If the integer indicator is present in format, $NUMBER checks for integers. An integercannot contain a decimal indicator character. Numeric strings (“123.45”) and numbers(123.45) are parsed differently. Numeric strings fail this integer test even if there are nodigits following the decimal indicator character, or if expansion of the exponent orrounding would eliminate the decimal digits. Numbers pass these validation tests. If anumber fails the integer indicator check, $NUMBER returns the null string ("").4. $NUMBER converts the number to a <strong>Caché</strong> canonical form number. It expands exponentialnotation, replaces enclosing parentheses with a negative sign character, strips off274 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

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

Saved successfully!

Ooh no, something went wrong!