Sign in to follow this  
Followers 0
Killer

number settings

5 posts in this topic

Hi,

Anyone knows how to set number vars to show 2 or more zeros?

Example $num=001 instead of $num=1

Share this post


Link to post
Share on other sites



Hi,

Anyone knows how to set number vars to show 2 or more zeros?

Example $num=001 instead of $num=1

do it as a string for example

$num = StringFormat("%03d", 1)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

do it as a string for example

$num = StringFormat("%03d", 1)
Doesn't work for me.

Share this post


Link to post
Share on other sites

Doesn't work for me.

Um... why not? :)

What version of AutoIt are you using... this function has been around for quite some time, and it works fine for me.

For $iCC = 1 To 99
    ConsoleWrite(StringFormat("%03d", $iCC) & @CRLF)
Next

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Um... why not? :)

What version of AutoIt are you using... this function has been around for quite some time, and it works fine for me.

For $iCC = 1 To 99
    ConsoleWrite(StringFormat("%03d", $iCC) & @CRLF)
Next
I am actually trying to do this. It will show a list of numbers. I want them in 2 digits. But in this case only 10 is 2 digit which is logical. Hope you get a clearer picture. Anyway I over came this problem using a if else for 1 to 9 to add a extra 0 in string format. Thanks for responding.

$x=0

$list=""

do

$x=$x+1

$list=$list&$x&chr(10)

until $x=10

msgbox(0,"list",$list)

Edited by Killer

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