Add leading zeros

  • July 31, 2009
  • 1 Comment

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.

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

Note: there is also a strLFix