高分求解几个问题。非常急!!! 同时求人民币金额小写转大写的程序.多谢多谢!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 人民币金额小写转大写(zt)public static String numtochinese(String input){ String s1="零壹贰叁肆伍陆柒捌玖"; String s4="分角整元拾佰仟万拾佰仟亿拾佰仟"; String temp=""; String result=""; if (input==null) return "输入字串不是数字串只能包括以下字符('0'~'9','.'),输入字串最大只能精确到仟亿,小数点只能两位!"; temp=input.trim(); float f; try{ f=Float.parseFloat(temp); }catch(Exception e){return "输入字串不是数字串只能包括以下字符('0'~'9','.'),输入字串最大只能精确到仟亿,小数点只能两位!";} int len=0; if (temp.indexOf(".")==-1) len=temp.length(); else len=temp.indexOf("."); if(len>s4.length()-3) return("输入字串最大只能精确到仟亿,小数点只能两位!"); int n1,n2=0; String num=""; String unit=""; for(int i=0;i<temp.length();i++){ if(i>len+2){break;} if(i==len) {continue;} 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("整"); if (len==temp.length()-2) result=result.concat("零分"); return result; } 关于HashSet 我才写了19行代码就报错了 JAVA 如何与UNIX、LINUX里的awk程序通信? 数据库连接池 Java中如何使用HTTP协议获得某网页的HTML代码 一个有趣的问题,大家都来看看(顶者有分诶) JSONObject一个方法问题 大家都来看看,项目的关键所在 -- 有关JAVA处理解压缩的问题 数据库连接问题,请高手指着,附带源码 开发中最常见的Hibernate问题 如何用java生成guid?如果有其它的生成唯一标识符的解决方案也可以 SQLServer自增长字段的问题
public static String numtochinese(String input){ String s1="零壹贰叁肆伍陆柒捌玖"; String s4="分角整元拾佰仟万拾佰仟亿拾佰仟"; String temp=""; String result=""; if (input==null) return "输入字串不是数字串只能包括以下字符('0'~'9','.'),输入字串最大只能精确到仟亿,小数点只能两位!"; temp=input.trim(); float f; try{ f=Float.parseFloat(temp); }catch(Exception e){return "输入字串不是数字串只能包括以下字符('0'~'9','.'),输入字串最大只能精确到仟亿,小数点只能两位!";} int len=0; if (temp.indexOf(".")==-1) len=temp.length(); else len=temp.indexOf("."); if(len>s4.length()-3) return("输入字串最大只能精确到仟亿,小数点只能两位!"); int n1,n2=0; String num=""; String unit=""; for(int i=0;i<temp.length();i++){ if(i>len+2){break;} if(i==len) {continue;} 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("整"); if (len==temp.length()-2) result=result.concat("零分"); return result; }