Sry.Solution.Components/numSwtichs.cs

(开头部分) 14KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

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

namespace Sry.Solution.Components
{
    /// <summary>
    /// 数字小写转大写,人民币
    /// </summary>
    public class numSwtichs
    {
        private readonly char[] chnGenText;
        private readonly char[] chnGenDigit;

        private readonly char[] chnRMBText;
        private readonly char[] chnRMBDigit;
        private readonly char[] chnRMBUnit;

        
        public numSwtichs()
        {
            // 一般大写中文数字组
            chnGenText = new char[] { '零', '一', '二', '三', '四', '五', '六', '七', '八', '九' };
            chnGenDigit = new char[] { '十', '百', '千', '万', '亿' };

            // 人民币专用数字组
            chnRMBText = new char[] { '零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖' };
            chnRMBDigit = new char[] { '拾', '佰', '仟', '萬', '億' };
            chnRMBUnit = new char[] { '角', '分' };
        }

        
        /// <summary>
        /// 主转换函数
        /// </summary>
        /// <param name="strDigit">待转换数字字符串</param>
        /// <param name="bToRMB">是否转换成人民币</param>
        /// <returns>转换成的大写字符串</returns>
        public string Convert(string strDigit, bool bToRMB)
        {
            // 检查输入数字有效性
            if (CheckDigit(ref strDigit, bToRMB))
            {

                // 定义结果字符串
                StringBuilder strResult = new StringBuilder();

                // 提取符号部分
                ExtractSign(ref strResult, ref strDigit, bToRMB);

                // 提取并转换整数和小数部分
                ConvertNumber(ref strResult, ref strDigit, bToRMB);

                return strResult.ToString();
            }
            else
            {
                //return "数据无效!";
                return "";
后面还有 364 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。