• 数字转大写(c#)


    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace bignum
    {
        class Program
        {
           static string[] bigNum ={ "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
            static String[] wei ={ "元", "拾", "佰", "仟", "万" };
            static String[] swei ={ "角", "分" };
            static string getnum(string i)
            {
                int tt=Convert.ToInt32(i);
                return bigNum[tt];
           
            }
            static void Main(string[] args)
            {
                float num = 0.3f;
                string temp = num.ToString();
                string strbig = "";
                int bi = temp.IndexOf(".");
                int si = 0;
                if (bi == -1)
                {
                    bi = temp.Length;
                    temp += ".00";
                    si = 0;
                }
                else
                {
                    si = temp.Length - (bi + 1);
                }
                int j=bi;
                Console.Write("{0} {1} {2}",temp.Length, bi, si);
                for (int i = 0; i < bi; i++)
                {
                    strbig += getnum(temp.Substring(i,1));
                    strbig +=wei[j-1];
                    j--;

                }
                temp = temp.Substring(bi+1, si);
                for (int i = 0; i < si; i++)
                {
                    strbig += getnum(temp.Substring(i, 1));
                    strbig += swei[i];
                }
                Console.WriteLine(strbig);
            }
        }
    }

  • 相关阅读:
    【Web安全】越权操作——横向越权与纵向越权
    【Web安全】越权操作——横向越权与纵向越权
    【Web安全】越权操作——横向越权与纵向越权
    【Web安全】越权操作——横向越权与纵向越权
    ajax学习摘抄笔记
    ajax学习摘抄笔记
    Struts2与Spring的整合
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
  • 原文地址:https://www.cnblogs.com/ahuo/p/611637.html
Copyright © 2020-2023  润新知