zoukankan      html  css  js  c++  java
  • 阿拉伯数字金额转换成中文大写

    //加到类的定义部分 
    private static string[] cstr ="""""""""""""""""""" };
    private static string[] wstr ="""""""""""""""""""""""""" };

    //数字必须在12位整数以内的字符串 
    //调用方式如:label1.text=convertint("数字字符串"); 

    public string ConvertToInt(string str)
    {
        
    int len = str.Length;
        
    int i;
        
    string tmpstr, rstr;
        rstr 
    = "";
        
    for (i = 1; i <= len; i++)
        {
            tmpstr 
    = str.Substring(len - i, 1);
            rstr 
    = string.Concat(cstr[int.Parse(tmpstr)] + wstr[i], rstr);
        }
        rstr 
    = rstr.Replace("拾零""");
        rstr 
    = rstr.Replace("零拾""");
        rstr 
    = rstr.Replace("零佰""");
        rstr 
    = rstr.Replace("零仟""");
        rstr 
    = rstr.Replace("零萬""");
        
    for (i = 1; i <= 6; i++)
            rstr 
    = rstr.Replace("零零""");
        rstr 
    = rstr.Replace("零萬""");
        rstr 
    = rstr.Replace("零億""");
        rstr 
    = rstr.Replace("零零""");
        rstr 
    += "圆整";
        
    return rstr;
    }
  • 相关阅读:
    【自学php】第三天
    【自学php】第二天
    【自学php】第一天-macbook上配置php
    js数值转换
    js题
    【练习】响应式布局
    6.数据查询
    5.删除数据
    4.更新数据
    3.插入数据
  • 原文地址:https://www.cnblogs.com/wangpei/p/1418514.html
Copyright © 2011-2022 走看看