- 4
- 0
- 约6.15千字
- 约 7页
- 2023-09-01 发布于上海
- 举报
金额转换,阿拉伯数字的金额转换成中国
传统的形式如:(¥1011)-gt;(一千零
一拾一元整)输出。
问题:金额转换,阿拉伯数字的金额转换成中国传统的形式如:
(¥1011)- (一千零一拾一元整)输出。 回答:
package test.format;
import java.text.NumberFormat;
import java.util.HashMap;
public class SimpleMoneyFormat {
public static final String EMPTY =
public static final String ZERO = 零
public static final String ONE = 壹
public static final String TWO = 贰
public static final String THREE = 叁
public static final String FOUR = 肆
public static final String FIVE = 伍
public static final String SIX = 陆
public static final String SEVEN = 柒
public static final String EIGHT = 捌
1
public static final String NINE = 玖
public static final String TEN = 拾
public static final String HUNDRED = 佰
public static final String THOUSAND = 仟
public static final String TEN_THOUSAND = 万
public static final String HUNDRED_MILLION = 亿
public static final String YUAN = 元
public static final String JIAO = 角
public static final String FEN = 分
public static final String DOT = .
private static SimpleMoneyFormat formatter = null;
private HashMap chineseNumberMap = new HashMap();
private HashMap chineseMoneyPattern = new HashMap();
private NumberFormat numberFormat =
NumberFormat.getInstance();
private SimpleMoneyFormat() {
numberFormat.setMaximumFractionDigits(4);
numberFormat.setMinimumFractionDigits(2);
numberFormat.setGroupingUsed(false);
chineseNumberMap.put( 0 , ZERO);
chineseNumberMap.put( 1 , ONE);
chineseNumberMap.put( 2 , TWO);
2
chineseNumberMap.put( 3 , THREE);
chineseNumberMap.put( 4 , FOUR);
chineseNumberMap.put( 5 , FIVE);
chineseNumberMap.put( 6 , SIX);
chineseNumberMap.put( 7 , SEVEN);
chineseNumberMap.put( 8 ,
您可能关注的文档
- 浅谈面向对象编程的优缺点.pdf
- 单摆周期与摆长的关系实验学案.pdf
- uniapp语音识别_uni-app开发APP语音播报功能.pdf
- 检修工作计划范文.pdf
- 江苏省无锡市2022年秋九年级化学期末模拟试卷(1)新人教版.pdf
- 最新译林英语三年级下册期中质量调研试卷.pdf
- redisson与spingboot版本不兼容的问题.pdf
- 实验二十二集成温度传感器的温度特性实验.pdf
- 《皇帝的新衣》读后感200字(3篇).pdf
- 污水处理厂运行部经理安全职责(2篇).pdf
- 七年级语文上册期末模拟试卷1(解析版).docx
- 七年级语文上册期末模拟试卷1(原卷版).docx
- 七年级语文上册期末模拟试卷2(原卷版).docx
- 七年级语文上册期末模拟试卷2(解析版).docx
- 期末测试卷(二)(解析版)2024—2025学年七年级语文上册期末测试卷(全国版).docx
- 期末测试卷(三)(解析版)2024—2025学年七年级语文上册期末测试卷(全国版).docx
- 期末测试卷(二)(原卷版)2024—2025学年七年级语文上册期末测试卷(全国版).docx
- 期末测试卷(三)(原卷版)2024—2025学年七年级语文上册期末测试卷(全国版).docx
- 期末测试卷(一)(原卷版)2024—2025学年七年级语文上册期末测试卷(全国版).docx
- 期末测试卷(一)(解析版)2024—2025学年七年级语文上册期末测试卷(全国版).docx
原创力文档

文档评论(0)