Is there a sprintf equivalent for node.js

后端 未结 4 1335
忘了有多久
忘了有多久 2021-02-11 12:08

Looking to do output formatting (sprintf type functionality) in node.js, but before I write it myself I was wondering if there\'s something similar built-in (I\'ve trawled the d

4条回答
  •  Happy的楠姐
    2021-02-11 12:43

    There is now printf-like support in util.format().

    Example:

    util.format('hello %s', 'world');
    // Returns: 'hello world'
    

提交回复
热议问题