import java.io.*;
import java.lang.String;
public class Switchover {
public static String[] strChi = {"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
public static String[] strUnits = {"","","拾","佰","仟","万","拾","佰","仟","亿","拾","佰","仟","兆","拾","佰","仟","角","分"};
//验证输入的数字是否符合要求
public boolean isNumeric(String str){
//if(str.matches("\\d+(.\\d+)$")){
if(str.matches("[\\d.]+")){
if (str.substring(0,1).equals("0") && !(str.substring(1,2).equals("."))){
return false;
}else{
return true;
}
}else{
return false;
}
}
//将小写转换成大写
public String NumToChi(String str,int iflag){
String ireturn = strChi[Integer.parseInt(str)]+strUnits[iflag];
if (str.equals("0") && (iflag==5)){return "万";}
if (str.equals("0") && (iflag==9)){return "亿";}
if (str.equals("0") && (iflag==13)){return "兆";}
if ((str.equals("0") && (iflag!=5))||(str.equals("0") && (iflag==9))||(str.equals("0") && (iflag==13))){
return "零";
}else{
return ireturn;
}
}
//去多余的零
public String DelZero(String str){
for (int i=0;i
if (str.indexOf("零零")>0){str=str.replace("零零", "零");}
if (str.indexOf("零万")>0){str=str.replace("零万", "万");}
if (str.indexOf("零亿")>0){str=str.replace("零亿", "亿");}
if (str.indexOf("零兆")>0){str=str.replace("零兆", "兆");}
if (str.indexOf("零圆")>0){str=str.replace("零圆", "圆");}
if (str.substring(0,1).equals(("零"))){str=str.replace(str.substring(0,1), ""); //去掉第一位的零
}
}
return str;
}
public static void main(String[] args){
Switchover switchover = new Switchover();
String inwrite="0"; //读取输入的数字
boolean flag=false; // do{}while(flag)使用的标记位
try {
do{
System.out.print("请输入数字('/'退出):");
do{
BufferedReader br = new BufferedReade