Communauté Eggdrop

Version complète : Afficher les séparateurs de milliers dans un nombre
Vous consultez actuellement la version basse qualité d’un document. Voir la version complète avec le bon formatage.
tcl
proc add_thousand_separators {value} {
	return [::tcl::string::trimleft [::tcl::string::reverse [regsub -all {...} [::tcl::string::reverse $value] {& }]] " "]
}



Exemple a écrit :add_thousand_separators 16165152
Tcl: 16 165 152

ou
tcl
proc add_thousand_separators {value} {
return [::tcl::string::trimleft [::tcl::string::reverse [regsub -all {...} [::tcl::string::reverse $value] {&.}]] "."]
}



Exemple a écrit :add_thousand_separators 16165152
Tcl: 16.165.152

Source : http://www.boulets.oqp.me/tcl/routines/t...-0001.html