lc_numeric (public)
lc_numeric num [ fmt ] [ locale ]
Defined in packages/acs-lang/tcl/localization-procs.tcl
Given a number and a locale return a formatted version of the number for that locale.
- Parameters:
- num (required)
- Number in canonical form
- fmt (optional)
- Format string used by the Tcl format command (should be restricted to the form "%.Nf" if present).
- locale (optional)
- Locale
- Returns:
- Localized form of the number
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- lang_test__lc_procs, lang_test__lc_content_size_pretty, lc__commify_number
Source code: if {$fmt ne ""} { set out [format $fmt $num] } else { set out $num } set sep [lc_get -locale $locale "thousands_sep"] set dec [lc_get -locale $locale "decimal_point"] set grouping [lc_get -locale $locale "grouping"] # Fall back on en_US if grouping is not on valid format if { $locale ne "en_US" && ![regexp {^[0-9 -]+$} $grouping] } { ns_log Warning "lc_numeric: acs-lang.localization-grouping key has " "invalid grouping value '$grouping' for locale '$locale'" set sep , set dec . set grouping 3 } regsub {\.} $out $dec out return [lc_sepfmt $out $grouping $sep]XQL Not present: PostgreSQL, Oracle Generic XQL file: packages/acs-lang/tcl/localization-procs.xql