JavaScript sprintf

来源:互联网 发布:八皇后算法 编辑:程序博客网 时间:2024/05/06 06:52

Return a formatted string

external links: original PHP docs | raw js source

Examples

» Example 1

Running

1
sprintf("%01.2f", 123.1);

 

Should return

1
123.10

 

 

» Example 2

Running

1
sprintf("[%10s]", 'monkey');

 

Should return

1
'[    monkey]'

 

 

Dependencies

No dependencies, you can use this function standalone.

 

 

下载代码:

http://download.csdn.net/source/1972080

http://d.namipan.com/d/ef8fc4b6a0ec4e761878b197441564c876bec24284320000

 

原文链接: http://phpjs.org/functions/sprintf:522