Jump to content

forcing my integers to be x digits long...


Recommended Posts

Link to comment
Share on other sites

That is by far one of the most confusing man pages I have read so far...

After about 20minutes of fiddling with it I am still unable to properly manipulate this command. If there is anyone that can help me understand this command or show me how to do this I would be much abliged. I got as far as: $volume = StringFormat("%%02 = [%02]\n", $volume) which did me no good at all...

My current alternative is about 15 variations of

If $chapter < 10 Then
                $curl &= "-00" 
            ElseIf $chapter < 100
                $curl &= "-0"
            ElseIf $chapter >= 100
                $curl &= "-" 
            EndIf
And that just looks terrible all over my code (I would seriously need about 15 instances of that format of code... this should be able to be done with like 2 lines declaring that they must be 2 or 3 digits...
Link to comment
Share on other sites

You want your numbers

001

002

003 and so on right? If so look at this.

For $i = 1 to 100
    $x = StringFormat('%03s', $i)
    ConsoleWrite( $x & @CRLF)
Next
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...