想在node.js中做输出格式化(sprintf类型功能),但在我自己编写之前,我想知道是否有类似内置的东西(我已经拖网文件无效)或者某人已经编写过模块.
非常感谢
lap*_*apo 65
现在有printf类似的支持util.format().
例:
util.format('hello %s', 'world');
// Returns: 'hello world'
Run Code Online (Sandbox Code Playgroud)
console.log 工作良好.
console.log('%d hours', 4); // 4 hours
console.log('The %2$s contains %1$d monkeys', 4, 'tree'); // The tree contains 4 monkeys
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
51116 次 |
| 最近记录: |