RMB conversion

xiaoxiao2021-03-06  42

Import java.util. *;

Public class? NumToChinese {? public string? NumToChinese (string mother) {??? string S1 = "Zero 壹 叁 伍 柒捌 柒捌"; ??? String S4 = "Point angle" Pick up 100 million "; ??? ??? String Temp ="; ??? String results = "; ??? ??? IF (Money.Length () == 0 || Money = = NULL) ????? Return "Please enter the digital character"; ??? ??? Temp = Money.trim (); ??? float f; ??? try {????? f = float. PARSEFLOAT (TEMP); ???} catch (NumberFormatexception E) {????? Return "Input Digital"; ???} ??? ??? INT LEN = 0; ??? IF (Temp.indexof ".") == - 1) {????? len = TEMP.LENGTH (); ???} else {????? len = Temp.indexof ("."); ???}? ???? if (len> s4.length () - 3) ????? Return? "The number entered can only enter hundreds of billions"; ??? ??? INT N1, N2; ??? String Num = ""; ??? String unit = ""; ??? ??? for (int i = 0; i

????? ife (i> len 2) {

??????? breaf;

?????}

????? if (i == len)

??????? a

????? n1 = integer.parseint (String.Valueof (Temp.Charat (i)));

????? Num = s1.substring (n1, n1 1);

????? n1 = len-i 2;

????? unit = s4.substring (N1, N1 1);

????? result = result.concat (num) .concat (unit);

???}

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

??? IF ((len == Temp.Length () || LEN == Temp.Length () - 1))

????? result = result.concat ("whole");

??? i (len == Temp.length () - 2)

????? result = result.concat ("zero points");

??? RETURN RESULT;

?

PUBLIC Static void main (string arg []) {

??? NumToChinese Num = new NumToChinese ();

??? System.out.println (Num.NumToChinese ("45621237012.56));

?

}

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

New Post(0)