Format MEL

From scripting
Jump to: navigation, search
global proc string Format(int $n, string $zeros) {
	//0001D LLC (c) 2016 Nick Pisca
	//int $n = 67; string $zeros = "00000"; string $jjj = Format(67, "0000");
	int $nn = size(string($n));
	int $zz = size($zeros);
	if ($nn < $zz) {
		string $tot = "";
		for ($x=0;$x<($zz-$nn);$x++) {
			$tot=$tot + "0";
		}
		$tot = $tot + string($n);
		return $tot;  print $tot;
	}
	return string($n);
}


More information on strings and naming, read pages 28-37 in YSYT.