index by "001" instead of "1"

I made a simple program that changes the names of my selected files to indexed files with the same name Like this
File1
File2
File3
File4
etc...
I want to have it count in triple digits rather than 1 digit until 10
and then 2digits until 100 and so on .
so those three would look like this
file001
file010
file100

instead of
file1
file10
file100

Comments

  • : I made a simple program that changes the names of my selected files to indexed files with the same name Like this
    : File1
    : File2
    : File3
    : File4
    : etc...
    : I want to have it count in triple digits rather than 1 digit until 10
    : and then 2digits until 100 and so on .
    : so those three would look like this
    : file001
    : file010
    : file100
    :
    : instead of
    : file1
    : file10
    : file100
    :
    :

    The String objects PadLeft property should do the trick for you. But first you must convert the integer to a string.

    [code]
    Dim i As String = 1
    Dim s As String = i.ToString.PadLeft(3, "0"c)
    [/code]


  • : : I made a simple program that changes the names of my selected files to indexed files with the same name Like this
    : : File1
    : : File2
    : : File3
    : : File4
    : : etc...
    : : I want to have it count in triple digits rather than 1 digit until 10
    : : and then 2digits until 100 and so on .
    : : so those three would look like this
    : : file001
    : : file010
    : : file100
    : :
    : : instead of
    : : file1
    : : file10
    : : file100
    : :
    : :
    :
    : The String objects PadLeft property should do the trick for you. But first you must convert the integer to a string.
    :
    : [code]
    : Dim i As String = 1
    : Dim s As String = i.ToString.PadLeft(3, "0"c)
    : [/code]
    :
    :

    I am very new to coding that was as I had thought but made it clear Big smile :) Thankyou very much

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories