Format the double form to Money

zhaozj2021-02-16  56

Import java.text. *; public class ut {private final static decimalformat nf = new decimalformat ("###, ## 0.00"); public static string formattomoney (String s) {if (s == null || s. Equals (")) {Return" 0.00 ";} Try {returnom (s));} catCH (Exception E) {Return S;}}

Public static string formattomoney (double d) {Return nf.format (d);} catCH (Exception E) {Return String.Valueof (d);}} public static void main (string [] args) {string DD = Client.formattomoney ("12345678990.78987"); System.out.Println (DD);

}

转载请注明原文地址:https://www.9cbs.com/read-25505.html

New Post(0)