java将数字转成中文_Java将数字字符串转换成中文形式?

Java将数字字符串转换成中文形式?

2009-10-31文字大小:大中小

public class MainClass3 {

/**

* @param args

* @deprecated 完成小数的中文转换

* @deprecated 核心工式:unit[(len - i - 1) % 8]

* @deprecated

* 1-0-1=0%8 亿

* 2-0-1=1%8 拾

* 3-0-1=2%8 佰

* 4-0-1=3%8 仟

* 5-0-1=4%8 万

* 6-0-1=5%8 拾

* 7-0-1=6%8 佰

* 8-0-1=7%8 仟

* 9-0-1=9%8 亿

*/

public static void main(String[] args) {

String temp0 = "987.65";// "009081";

String temp = temp0;

if (temp0.startsWith("0")) {

temp = String.valueOf(Integer.parseInt(temp0));

// System.out.println(Integer.parseInt(temp));

}

// int itemp = Integer.valueOf(temp);

// System.out.println("String --> Integer"+itemp);

StringBuffer retStrBuf = new StringBuffer();// 用来拼接数字串

int dot = 0; // 小数点位置

int ivalue = 0;// 保存每一个位上的数

int len = 0;// 保存数字的长度

for (int i = 0; i < temp.length(); i++) {

System.out.print(temp.substring(i, i + 1) + " ");

}

System.out.println();

String num[] = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };

String unit[] = { "亿", "拾", "佰", "仟", "万", "拾", "佰", "仟" };

len = temp.length();

if (temp == null "".equals(temp) temp.length() <= 0) {

System.out.println("Input is null");

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值