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


Sujets apparemment similaires…
Sujet Auteur Réponses Affichages Dernier message
  Convertir un nombre d'octets en ko/Mo/Go/To/Po/Eo/Zo ou kio/Mio/Gio/Tio/Pio/Eio/Zio MenzAgitat 3 4,428 07/10/2013, 23:10
Dernier message: CrazyCat

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)