Give the code directly, copy it and use it

Public static String arabiaToChinese(String number){if(isBlank(number)){return "0 "; } if(! IsNumeric (number)){// Is there any numeric type return ""; } number = number.replaceAll(",",""); number = number.replaceAll(" ",""); If (Double. ParseDouble (number) == 0){return "zero "; } BigDecimal decimal = new BigDecimal(number); number = decimal.toString(); String[] num = number.split("\\."); String head = num[0]; If (head.length() > 10){system.out.println (" number over a billion, can't calculate "); return ""; } StringBuffer headNew = new StringBuffer(); for(int i = head.length() - 1; i >= 0; i--){ String si = String.valueOf(head.charAt(i)); StringBuffer headNewString = new StringBuffer(); //String ss = String.valueOf( num[0].charAt(i)); Switch (string.valueof (head.charat (I))){case "0": headNewString.appEnd (" 0" + headNewString); break; Case "1":headNewString. Append (" 1" + headNewString); break; Case "2":headNewString. Append (" 2" + headNewString); break; Case "3":headNewString. Append (" 3" + headNewString); break; Case "4":headNewString. Append (" 4" + headNewString); break; Case "5":headNewString. Append (" five "+ headNewString); break; Case "6":headNewString. Append (" lu "+ headNewString); break; Case "7":headNewString. Append ("柒" + headNewString); break; Case "8":headNewString. Append (" EIGHT "+ headNewString); break; Case "9":headNewString. Append (" nine "+ headNewString); break; } switch (num[0].length() -i - 1){case 0: headNewString.appEnd ("元"); break; case 1:if(!" 0 "equals (si)) headNewString. Append (" pick up"); break; case 2:if(!" 0 "equals (si)) headNewString. Append (" hk"); break; case 3:if(!" 0 "equals (si)) headNewString. Append (" $"); break; Case 4: headNewString append (" over "); break; case 5:if(!" 0 "equals (si)) headNewString. Append (" pick up"); break; case 6:if(!" 0 "equals (si)) headNewString. Append (" hk"); break; case 7:if(!" 0 "equals (si)) headNewString. Append (" $"); break; Case 8: headNewString. Append (" $"); break; Case 9: headNewString. Append (" pick up "); break; } headNew = headNewString.append(headNew); } if(num. Length > 1){if(num[1].length() > 2){system.out.println (" only two digits after the decimal point, the System will truncate "); Num = [1] num. [1] the substring (0, 2); } char[] tail = num[1].toCharArray(); for (int i = 0; i < tail.length; i++) { StringBuffer tailNewString = new StringBuffer(); Switch (String.valueof (tail[I])){case "0":tailNewString. Append (" 0" + tailNewString); break; Case "1":tailNewString. Append (" 1" + tailNewString); break; Case "2":tailNewString. Append (" 2" + tailNewString); break; Case "3":tailNewString. Append (" 3" + tailNewString); break; Case "4":tailNewString. Append (" 4" + tailNewString); break; Case "5":tailNewString. Append (" five "+ tailNewString); break; Case "6":tailNewString. Append (" lu "+ tailNewString); break; Case "7":tailNewString. Append (" SEVEN "+ tailNewString); break; Case "8":tailNewString. Append (" EIGHT "+ tailNewString); break; Case "9":tailNewString. Append (" nine "+ tailNewString); break; } if(I == 0) tailNewString.appEnd (" Angle "); If (I == 1) tailNewString.append("分"); headNew.append(tailNewString); } } String subject = headNew.toString(); While (subject. Contains (" 0 ")) {subject = subject. ReplaceAll (" 0 ", "0 "); } subject = subject. ReplaceAll (" 0 billion "," 100 million "); Subject = subject. ReplaceAll (" billions "," billions "); ReplaceAll (" 0 million "," 1 million "); Subject = subject. ReplaceAll (" 0 "," 0 "); ReplaceAll (" 0 ",""); ReplaceAll (" 0 分",""); String c = String.valueOf(subject.charAt(subject.length() - 1)); If (" yuan ". The equals (c) | | "Angle". The equals (c)) {subject = subject + "whole"; } return subject; }Copy the code