. 1 public class NumToChineseUtil { 2 . 3 / ** . 4 * the Java useful . 5 * int Chinese digitizer . 6 * @param the src . 7 * @return . 8 * / . 9 public static String Read ( int the src) { 10 Final String NUM [] = { "zero", "one", "two", "three", "four", "five," "six," "seven," "eight," "nine" }; . 11 Final String Unit [] = { "", "ten", "100", "thousand", "Wan", "ten", "100", "thousands""亿", "十", "百", "千"}; 12 String dst = ""; 13 int0 = COUNT ; 14 the while (the src> 0 ) { 15 DST = (NUM [10% the src] + Unit [COUNT]) + DST; 16 the src the src = / 10 ; . 17 COUNT ++ ; 18 is } . 19 IF (dst.startsWith ( "ten" )) { 20 is DST dst.substring = (. 1 ); 21 is } 22 is return dst.replaceAll ( "zero [Qianbaishi]", "zero") .replaceAll ( "zero + Million", "Wan" ) 23 .replaceAll ( "zero + one hundred million", "100 million") .replaceAll ( "hundreds of millions", "$ 201" ) 24 .replaceAll("零+", "零").replaceAll("零$", ""); 25 26 } 27 }
Java Numbering turn to read and write Chinese numbers
Guess you like
Origin www.cnblogs.com/bevis-byf/p/12103161.html
Recommended
Ranking