Archive for the ‘MEL’ Category

MEL: Padding Function

Tuesday, August 19th, 2008

This is a little function that takes a number and adds padding to it.

global proc string padNumber(int $number, int $length){
	string $paddedString = string($number);
	while(size($paddedString)<$length)
		$paddedString = ("0"+$paddedString);
	return $paddedString;
}

Example:
padNumber 55 4;
// Result: 0055