Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
proc commaPrs {instrng} {
#strip off the decimal characters
regexp {([0-9]*)(.[0-9]*)} $instrng match bodstr stend
set lbod [string length $bodstr]
#number of commas
set A [expr int($lbod/3)]
set R [expr int(fmod($lbod,3))]
if {$R != 0} then {append ostrng [string range $instrng 0 [expr {$R-1}]]}
if {$A == 0} then {
append ostrng $stend
return $ostrng
}
for {set i 1} {$i<=$A} {incr i} {
set inx0 [expr ($i-1)*3 + $R ]
set inx1 [expr $inx0 +2]
if {($i==1) && ($R==0)} then {
append ostrng [string range $instrng $inx0 $inx1]
} else {
append ostrng ,[string range $instrng $inx0 $inx1]
}
}
append ostrng $stend
return $ostrng
}
proc commaPrs {instrng} {
#strip off the decimal characters
regexp {([0-9]*)([red]\.[/red][0-9]*)} $instrng match bodstr stend
[red]if [catch {set match}] {set bodstr $instrng; set stend ""}[/red]
set lbod [string length $bodstr]
#number of commas
set A [expr int($lbod/3)]
set R [expr int(fmod($lbod,3))]
if {$R != 0} then {append ostrng [string range $instrng 0 [expr {$R-1}]]}
if {$A == 0} then {
append ostrng $stend
return $ostrng
}
for {set i 1} {$i<=$A} {incr i} {
set inx0 [expr ($i-1)*3 + $R ]
set inx1 [expr $inx0 +2]
if {($i==1) && ($R==0)} then {
append ostrng [string range $instrng $inx0 $inx1]
} else {
append ostrng ,[string range $instrng $inx0 $inx1]
}
}
append ostrng $stend
return $ostrng
}
proc commaPrs {instrng} {
#strip off the decimal characters
set dl [split $instrng .]
foreach {bodstr stend} $dl {}
set lbod [string length $bodstr]
#number of commas
set A [expr int($lbod/3)]
set R [expr int(fmod($lbod,3))]
if {$R != 0} then {append ostrng [string range $instrng 0 [expr {$R-1}]]}
if {$A == 0} then {
return [join "$bodstr $stend" .]
}
for {set i 1} {$i<=$A} {incr i} {
set inx0 [expr ($i-1)*3 + $R ]
set inx1 [expr $inx0 +2]
if {($i==1) && ($R==0)} then {
append ostrng [string range $instrng $inx0 $inx1]
} else {
append ostrng ,[string range $instrng $inx0 $inx1]
}
}
return [join "$ostrng $stend" .]
}
proc commaPrs {instrng} {
#strip off the decimal characters
set dl [split $instrng .]
foreach {bodstr stend} $dl {}
#break body into "threes"
while {[string length $bodstr]>0} {
lappend l [string range $bodstr end-2 end]
set bodstr [string range $bodstr 0 end-3]
}
#reverse the list
set i [llength $l]
incr i -1
while {$i>=0} {lappend l2 [lindex $l $i];incr i -1}
#regroup
set ostrng [join $l2 ,]
return [join "$ostrng $stend" .]
}