Jump to content

number settings


Killer
 Share

Recommended Posts

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.

 

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...