lc_parse_number (public)

 lc_parse_number num locale [ integer_only_p ]

Defined in packages/acs-lang/tcl/localization-procs.tcl

Converts a number to its canonical representation by stripping everything but the decimal separator and trimming left 0's so it won't be octal. It can process the following types of numbers:

  • Just digits (allows leading zeros).
  • Digits with a valid thousands separator, used consistently (leading zeros not allowed)
  • Either of the above with a decimal separator plus optional digits after the decimal marker
The valid separators are taken from the given locale. Does not handle localized signed numbers in this version. The sign may only be placed before the number (with/without whitespace). Also allows the empty string, returning same.

Parameters:
num (required)
Localized number
locale (required)
Locale
integer_only_p (optional, defaults to "0")
True if only integers returned
Returns:
Canonical form of the number
Error:
If unsupported locale or not a number

Partial Call Graph (max 5 caller/called nodes):
%3 test_lang_test__lc_procs lang_test__lc_procs (test acs-lang) lc_parse_number lc_parse_number test_lang_test__lc_procs->lc_parse_number lang::util::escape_vars_if_not_null lang::util::escape_vars_if_not_null (private) lc_parse_number->lang::util::escape_vars_if_not_null lc_get lc_get (public) lc_parse_number->lc_get util::trim_leading_zeros util::trim_leading_zeros (public) lc_parse_number->util::trim_leading_zeros Class ::xowiki::formfield::numeric Class ::xowiki::formfield::numeric (public) Class ::xowiki::formfield::numeric->lc_parse_number

Testcases:
lang_test__lc_procs
[ show source ]
Show another procedure: