JavaScript culture sensitive currency formatting

后端 未结 3 1977
无人及你
无人及你 2021-01-12 20:08

How can i format currency related data in a manner that is culture aware in JavaScript?

相关标签:
3条回答
  • 2021-01-12 20:47

    there is a Number.localeFormat function but I'm not sure it's what your after

    http://msdn.microsoft.com/en-gb/library/bb310813.aspx

    0 讨论(0)
  • 2021-01-12 20:55

    Dojo has a currency formatter that's locale aware.

    If you don't want to include Dojo in your project just for this function, then perhaps you can localize the currency in your back-end?

    0 讨论(0)
  • 2021-01-12 21:09

    Number.toLocaleString (implemented in JavaScript 1.5, ECMAScript 3rd Edition)

    var number = 3500;
    console.log(number.toLocaleString()); /* Displays "3,500" in English locale */
    

    Docs on MDN.

    0 讨论(0)
提交回复
热议问题