Afficher les séparateurs de milliers dans un nombre
#1
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
Répondre Avertir


Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)
Tchat 100% gratuit -Discutez en toute liberté