Tôi reco mmend sử dụng DEFAULT giá trị (= dựa trên miền địa phương) trong trường hợp ứng dụng của bạn có để đối phó với các ngôn ngữ khác nhau:
${#numbers.formatDecimal(abc.value, 0, 'DEFAULT', 2, 'DEFAULT')}
Từ Thymeleaf doc (chính xác hơn NumberPointType):
/*
* Set minimum integer digits and thousands separator:
* 'POINT', 'COMMA', 'NONE' or 'DEFAULT' (by locale).
* Also works with arrays, lists or sets
*/
${#numbers.formatInteger(num,3,'POINT')}
${#numbers.arrayFormatInteger(numArray,3,'POINT')}
${#numbers.listFormatInteger(numList,3,'POINT')}
${#numbers.setFormatInteger(numSet,3,'POINT')}
/*
* Set minimum integer digits and (exact) decimal digits, and also decimal separator.
* Also works with arrays, lists or sets
*/
${#numbers.formatDecimal(num,3,2,'COMMA')}
${#numbers.arrayFormatDecimal(numArray,3,2,'COMMA')}
${#numbers.listFormatDecimal(numList,3,2,'COMMA')}
${#numbers.setFormatDecimal(numSet,3,2,'COMMA')}
Có khả năng để loại bỏ '10.00' của zero, hmm Nó sẽ sạch hơn để chỉ hiển thị các số thập phân khi có bất kỳ, nhưng nếu chúng ta có một số thập phân để nó có được làm tròn tới '435.89' ?? – azerafati