zoukankan      html  css  js  c++  java
  • C#实现将商品金额小写转换成大写

    /// <summary>
            /// 将商品金额小写转换成大写
            /// </summary>
            /// <param name="par">小写金额</param>
            /// <returns>处理后的大写金额</returns>
            public static string MoneySmallToBig(string par)
            {
                String[] Scale = { "", "", "", "", "", "", "", "", "", "", "亿", "", "", "", "", "", "", "" };
                String[] Base = { "", "", "", "", "", "", "", "", "", "" };
                string Temp = par;
                object str = Temp[1];
                string result = null;
                int index = Temp.IndexOf(".", 0, Temp.Length);//判断是否有小数点
                if (index != -1)
                {
                    Temp = Temp.Remove(Temp.IndexOf("."), 1);
                    for (int i = Temp.Length; i > 0; i--)
                    {
                        int Data = Convert.ToInt16(Temp[Temp.Length - i]);//得到对应的ASCII码值
                        result += Base[Data - 48];
                        result += Scale[i - 1];
                    }
                }
                else
                {
                    for (int i = Temp.Length; i > 0; i--)
                    {
                        int Data = Convert.ToInt16(Temp[Temp.Length - i]);
                        result += Base[Data - 48];
                        Console.WriteLine(result);
                        result += Scale[i + 1];
                        Console.WriteLine(result);
                    }
                }
                //Console.WriteLine(Base[43]);
                return result;
            }
  • 相关阅读:
    教你透彻了解红黑树(转)
    算法描述伪代码
    B 树、B+ 树、B* 树
    Java四种引用类型
    Java程序以后台方式在Linux上运行(nohup命令)
    java 文档注释
    Reactor模式和NIO
    Immutable模式与string类的实现
    mina 入门
    索引和优化查询
  • 原文地址:https://www.cnblogs.com/sdd53home/p/13572538.html
Copyright © 2011-2022 走看看