Number formatting in java to use Lakh format instead of million format

后端 未结 3 1365
伪装坚强ぢ
伪装坚强ぢ 2020-12-06 18:11

I have tried using NumberFormat and DecimalFormat. Even though I am using the en-In locale, the numbers are being formatted in Western

3条回答
  •  清歌不尽
    2020-12-06 19:00

    While the standard Java number formatter can't handle this format, the DecimalFormat class in ICU4J can.

    import com.ibm.icu.text.DecimalFormat;
    
    DecimalFormat f = new DecimalFormat("#,##,##0.00");
    System.out.println(f.format(1234567));
    // prints 12,34,567.00
    

提交回复
热议问题