문제

I format a number like this:

function pointToComma(number) {
  number = Number(number).toLocaleString();
  return number;
}

As w3schools (http://www.w3schools.com/jsref/jsref_tolocalestring.asp) states the function toLocalStrin() convert a Date object to a string, using locale conventions.

I want to use this function to output the number into a german format. This means commas instead of points for decimals and points to separate thousands. I need the german format in any case. So is there a way to set the local settings fix in that example?

도움이 되었습니까?

해결책

Solved it:

.toLocaleString('de-DE')

See more options

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top