Notifications
Clear all

[Closed] Fixed character count in maxscript?

Hi guys,
Got a question here.

My script receives an integer between 0 and 999.
I want to represent that integer as a fixed number of characters
1 becomes “001”
5 becomes “005”
17 becomes “017”
44 becomes “044”
156 becomes “156”

Is there an easy way to do this in maxscript? currently im having to take the integer and do a rather silly looking if x/10 <1 , if x/100 < 1 etc.

Thanks in advance.

2 Replies
formattedprint x format:"03d"

that will do what you want, look up formattedPrint in the help to see what else it can do

Many thanks!
Now I can remove the ugly from my code