JavaScript equivalent to printf/String.Format

前端 未结 30 2402
囚心锁ツ
囚心锁ツ 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条回答
  •  梦毁少年i
    2020-11-21 05:20

    If you are looking to handle the thousands separator, you should really use toLocaleString() from the JavaScript Number class since it will format the string for the user's region.

    The JavaScript Date class can format localized dates and times.

提交回复
热议问题