eZ Community » Forums » General » Left padding with zeros
expandshrink

Left padding with zeros

Left padding with zeros

Thursday 13 November 2003 12:49:29 pm - 1 reply

Hi

Can anyone give me a suggestion on how to LEFT pad a string with zeros. I had a look at the pad() operator but it only seems to do right padding.

I would like to avoid writing a new operator, so any other suggestions would be appreciated.

Thanks

Thursday 09 August 2012 6:58:19 am

Hi Tristan,

Since your post is so old, maybe you have already resolved this issue.
But I post for community member.I implemented this function like the following.

{def $padedstr = $inputstr | reverse() | pad( 4, '0' ) | reverse()}

Regards,
Yamanaka

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu