Printf-as是一个可以处理此问题的第三方库.这是GitHub回购.来自README:
printf("You can also display numbers like PI: %f, and format them to a fixed precision,
such as PI with 3 decimal places %.3f", Math.PI, Math.PI);
// outputs: " You can also display numbers like PI: 3.141592653589793,
// and format them to a fixed precision, such as PI with 3 decimal places 3.142"
Run Code Online (Sandbox Code Playgroud)
它也适用于日期:
var date : Date = new Date();
printf("Today is %d/%m/%Y", date, date, date);
Run Code Online (Sandbox Code Playgroud)
小智 7
认为你可能正在寻找StringUtil.substitute()
看看这里:http: //help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/utils/StringUtil.html#substitute
| 归档时间: |
|
| 查看次数: |
9795 次 |
| 最近记录: |