Change an integar to a string, but add many 0 in the front

   976   4   1
User Avatar
Member
16 posts
Joined: 9月 2020
Offline
I want to change an integar to a string, but add many 0 in the front.
For example, change 2 to "002".
How do I do that?
User Avatar
Member
7812 posts
Joined: 9月 2011
Online
in hscript there's padzero()

for example:
>>> fcur 3
>>> echo `padzero(3, $F)`
003
User Avatar
Member
16 posts
Joined: 9月 2020
Offline
jsmack
in hscript there's padzero()

for example:
>>> fcur 3
>>> echo `padzero(3, $F)`
003
Thanks!
User Avatar
Member
16 posts
Joined: 9月 2020
Offline
mestela
padzero in hscript, or sprintf in vex.

https://www.sidefx.com/docs/houdini/expressions/padzero.html [www.sidefx.com]

https://www.sidefx.com/docs/houdini/vex/functions/sprintf.html [www.sidefx.com]
Thanks!
  • Quick Links