Page 1 sur 1
[R] Incrementation +1 avec trois chiffre en partant de 0
Posté : lun. 19 déc. 2011 22:41
par aikiox
Bonjour,
Je n'arrive pas à faire une incrementation 1 par 1 en demarrant de 000 jusqu'a 099.
J'aimerais obtenir :
001
002
....
011
012
....
Voici mon code...
Code : Tout sélectionner
Global $i, $max
$max = "099"
for $i = "001" to $max step 1
MsgBox(0,"", $i)
Next
Cordialement
Romain
Re: [..] Incrementation +1 avec trois chiffre en partant de
Posté : lun. 19 déc. 2011 22:53
par sylvanie
En systématique on a :
Code : Tout sélectionner
Global $i, $max
$max = 99
for $i = 1 to $max step 1
MsgBox(0,"", StringRight("00"&$i,3))
Next
Re: [..] Incrementation +1 avec trois chiffre en partant de
Posté : lun. 19 déc. 2011 22:56
par aikiox
Bonjour,
Merci pour ta reponse, je vais essayer.
Romain
Re: [..] Incrementation +1 avec trois chiffre en partant de
Posté : lun. 19 déc. 2011 23:07
par mikell
sylvanie, ouah !
Code : Tout sélectionner
Global $i, $max
$max = 999
for $i = 1 to $max step 1
MsgBox(0,"", StringFormat("%03d", $i))
Next
Re: [..] Incrementation +1 avec trois chiffre en partant de
Posté : lun. 19 déc. 2011 23:12
par sylvanie
Ah oui, c'est vrai qu'il y a stringformat, je n'y pense jamais à celle-ci.
Re: [..] Incrementation +1 avec trois chiffre en partant de
Posté : lun. 19 déc. 2011 23:14
par mikell
Comme moi avec les regexp, quoi....
Sympa ton avatar, c'est Segur ?
Re: [R] Incrementation +1 avec trois chiffre en partant de
Posté : lun. 19 déc. 2011 23:16
par aikiox
GENIAL, ca fonctionne !
Merci
Re: [..] Incrementation +1 avec trois chiffre en partant de
Posté : lun. 19 déc. 2011 23:29
par sylvanie
mikell a écrit :Comme moi avec les regexp, quoi....
Ah, non c'est pas pareil, moi j'oublie simplement de l'utiliser, sinon je sais comment ça marche
