Doens.be

  • Linkedin flickr twitter delicious Facebook Youtube

Add leading zeros

You want to show a integer with a fixed length (for example 2characters: 1 –> 01). You don’t have to write your own for-loop to ad the zero’s in front or something like that. The function strRFix does this for you automaticly.

1
info(strRFix(int2str(1), 2, '0'));

Note: there is also a strLFix

Tags: , , , ,

One Response to “Add leading zeros”

  1. August 3rd, 2009 at 10:48

    Art Of Creation – Dynamics AX Blog » Remove leading zeros says:

    [...] you’ll want to add leading zeros to a string, but other times, you’ll have to remove leading zeros from a string. Here the code that does [...]

Leave a Reply