//不是角分结尾就加"整"字
if (!result.endsWith(“角”)&&!result.endsWith(“分”)) {
result = result + “整”;
}
//例如没有这行代码,数值"400000001101.2",输出就是"肆千亿万壹千壹佰零壹元贰角"
result = result.replaceAll(“亿万”, “亿”);
return result;
}
}
日期转大写:
package test;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateTranCnDate {
public DateTranCnDate() {
}
/**
-
字符串日期转换成中文格式日期
-
@param date 字符串日期 yyyy-MM-dd
-
@return yyyy年MM月dd日
-
@throws Exception
*/
public static String dateToCnDate(String date) {
String result = “”;
String[] cnDate = new String[]{“零”,“壹”,“贰”,“叁”,“肆”,“伍”,“陆”,“柒”,“捌”,“玖”};
String ten = “