JavaScript equivalent to printf/String.Format

前端 未结 30 2413
囚心锁ツ
囚心锁ツ 2020-11-21 04:27

I\'m looking for a good JavaScript equivalent of the C/PHP printf() or for C#/Java programmers, String.Format() (IFormatProvider for .

30条回答
  •  死守一世寂寞
    2020-11-21 05:27

    I'll add my own discoveries which I've found since I asked:

    • number_format (for thousand separator/currency formatting)
    • sprintf (same author as above)

    Sadly it seems sprintf doesn't handle thousand separator formatting like .NET's string format.

提交回复
热议问题