arthur-debert/printf-as3 — Issue #15: padding is not right
Author: davyzhang
Created: 2011-12-07 15:50:54+00:00
State: open

printf("this is %03d%s",1,'A')

output
this is 0001A

should be
this is 001A

I checked your function
/** @private */
function padString(str:String, paddingNum:int, paddingChar:String=" ") : String
{
if(paddingChar == null) return str;

return new Array(paddingNum + 1).join(paddingChar).concat(str);
}

it's not right for padding, array,joined the padding char at first And append the str at last

should be like this one

/** @private */
function padString(str:String, paddingNum:int, paddingChar:String=" ") : String
{
if(paddingChar == null) return str;

return new Array(paddingNum + 1).join(paddingChar).substr(0,paddingNum-str.length).concat(str);
}