View Full Version : Stupid Easy question.

04 April 2008, 10:34 AM
I have a variable with an integer value, but i want to use this as a string with a zero in front of it.... eg...

v = 1

textbox.text = v

output is "1"

I want this to be "01", there is of course easy way round this = "0" + V but don't want it to then become 010, 011, 012 i want to limit to 2 numbers, without having to do a if v < 10 test.

In VB you could do it with Format() function, but had a look through the Maxscript guide and can't find anything that helps me with this issue.

I'm sure there is an easy solution i'm missing.

04 April 2008, 10:51 AM
formattedPrint is the function you're looking for .. eg

for i = 0 to 20 do(
print (formattedPrint i format: "02d")

04 April 2008, 11:08 AM
Awesome cheers mate.

CGTalk Moderation
04 April 2008, 11:08 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.