String Formatter in GWT

前端 未结 12 656
生来不讨喜
生来不讨喜 2021-02-03 18:59

How do I format my string in GWT?

I made a method

  Formatter format = new Formatter();
    int matches = 0;
    Formatter formattedString = format.forma         


        
12条回答
  •  被撕碎了的回忆
    2021-02-03 19:57

    As an alternative you can use class NumberFormat:

    NumberFormat fmt = NumberFormat.getDecimalFormat();
    double value = 12345.6789;
    String formatted = fmt.format(value);
    // Prints 1,2345.6789 in the default locale
    

提交回复
热议问题