Sign in to follow this  
Followers 0
NSearch

Format Numbers

3 posts in this topic

Is there any way to format numbers to a certain length.

I want to increment a number by one each time I go through a while loop, but I want the result to be:

001

002

003

004

005

Instead of:

1

2

3

4

5

I can not seem to find any help in the online documentation.

Thanks.

Share this post


Link to post
Share on other sites



; w0uter's method
For $count = 5 to 15
    MsgBox(4096,"", StringFormat("%03u", $count))
Next


;Another way to think about the problem
For $count = 5 to 15
    If $count < 10 Then
        MsgBox(4096,"", "00" & $count)
    ElseIf $count < 100 Then
        MsgBox(4096,"", "0" & $count)
    Else
        MsgBox(4096,"", $count)
    EndIf
Next


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0