11 proc ::utils::thousands {n {kilo 0}} {
13 set commaChar [
string index $locale(numeric) 1]
17 set decimalChar [
string index $locale(numeric) 0]
18 set decimalPart [
format "%02d" [
expr {(int($n / 10000)) % 100}]]
19 set n [
expr {int($n) / 1000000}]
20 set unit "${decimalChar}${decimalPart}M"
21 }
elseif {$n >= 100000} {
23 set n [
expr {int($n / 1000)}]
26 if {$commaChar == ""} {
return "$n$unit"}
27 while {[regsub {^([-+]?[0-9]+)([0-9][0-9][0-9])} $n "\\1$commaChar\\2" n]} {}
31 proc ::utils::percentFormat {num denom} {
33 if {$denom == 0} {
set denom 1}