コード例 #1
0
        public static string LowercaseGetCap(string NumStr, bool Dw)
        {
            string text = "";

            if (NumStr == string.Empty)
            {
                return(string.Empty);
            }
            if (Dw)
            {
                NumStr = NumGetString.Reversion_Str(NumStr);
            }
            string result;

            try
            {
                for (int i = 0; i < NumStr.Length; i++)
                {
                    string text2 = NumStr.Substring(i, 1);
                    if (Dw)
                    {
                        if (int.Parse(text2) != 0)
                        {
                            text = NumGetString.Ls_ShZ[int.Parse(text2)] + NumGetString.Num_DW[i] + text;
                        }
                        else if (i == 0 || i == 4 || i == 8)
                        {
                            if (text2.Length <= 8 || i != 4)
                            {
                                text = NumGetString.Num_DW[i] + text;
                            }
                        }
                        else if (int.Parse(NumStr.Substring(i - 1, 1)) != 0)
                        {
                            text = NumGetString.Ls_ShZ[int.Parse(text2)] + text;
                        }
                    }
                    else
                    {
                        text += NumGetString.Ls_ShZ[int.Parse(text2)];
                    }
                }
                result = text;
            }
            catch (Exception ex)
            {
                result = "转换错误!" + ex.Message;
            }
            return(result);
        }
コード例 #2
0
        public static string LowercaseGetCap(string NumStr, bool Dw)
        {
            string str = "";

            if (NumStr == string.Empty)
            {
                return(string.Empty);
            }
            if (Dw)
            {
                NumStr = NumGetString.Reversion_Str(NumStr);
            }
            try
            {
                for (int startIndex = 0; startIndex < NumStr.Length; ++startIndex)
                {
                    string s = NumStr.Substring(startIndex, 1);
                    if (Dw)
                    {
                        if (int.Parse(s) != 0)
                        {
                            str = NumGetString.Ls_ShZ[int.Parse(s)] + NumGetString.Num_DW[startIndex] + str;
                        }
                        else if (startIndex == 0 || startIndex == 4 || startIndex == 8)
                        {
                            if (s.Length <= 8 || startIndex != 4)
                            {
                                str = NumGetString.Num_DW[startIndex] + str;
                            }
                        }
                        else if (int.Parse(NumStr.Substring(startIndex - 1, 1)) != 0)
                        {
                            str = NumGetString.Ls_ShZ[int.Parse(s)] + str;
                        }
                    }
                    else
                    {
                        str += NumGetString.Ls_ShZ[int.Parse(s)];
                    }
                }
                return(str);
            }
            catch (Exception ex)
            {
                return("转换错误!" + ex.Message);
            }
        }
コード例 #3
0
        public static string NumGetStr(double Num)
        {
            bool   flag  = false;
            bool   flag2 = true;
            string text  = "";
            string text2 = "";

            Num = Math.Round(Num, 2);
            if (Num < 0.0)
            {
                return("不转换欠条");
            }
            if (Num > 9999999999999.99)
            {
                return("很难想象谁会有这么多钱!");
            }
            if (Num == 0.0)
            {
                return(NumGetString.Ls_ShZ[0]);
            }
            if (Num < 1.0)
            {
                flag2 = false;
            }
            string text3 = Num.ToString();
            string text4 = text3;

            if (text4.Contains("."))
            {
                text4 = text3.Substring(0, text3.IndexOf("."));
                text  = text3.Substring(text3.IndexOf(".") + 1, text3.Length - text3.IndexOf(".") - 1);
                flag  = true;
            }
            if (text == "" || int.Parse(text) <= 0)
            {
                flag = false;
            }
            if (flag2)
            {
                text4 = NumGetString.Reversion_Str(text4);
                for (int i = 0; i < text4.Length; i++)
                {
                    string s = text4.Substring(i, 1);
                    if (int.Parse(s) != 0)
                    {
                        text2 = NumGetString.Ls_ShZ[int.Parse(s)] + NumGetString.Ls_DW_Zh[i] + text2;
                    }
                    else if (i == 0 || i == 4 || i == 8)
                    {
                        if (text4.Length <= 8 || i != 4)
                        {
                            text2 = NumGetString.Ls_DW_Zh[i] + text2;
                        }
                    }
                    else if (int.Parse(text4.Substring(i - 1, 1)) != 0)
                    {
                        text2 = NumGetString.Ls_ShZ[int.Parse(s)] + text2;
                    }
                }
                if (!flag)
                {
                    return(text2 + "整");
                }
            }
            for (int j = 0; j < text.Length; j++)
            {
                string s = text.Substring(j, 1);
                if (int.Parse(s) != 0)
                {
                    text2 = text2 + NumGetString.Ls_ShZ[int.Parse(s)] + NumGetString.Ls_DW_X[j];
                }
                else if (j != 1 && flag2)
                {
                    text2 += NumGetString.Ls_ShZ[int.Parse(s)];
                }
            }
            return(text2);
        }
コード例 #4
0
        public static string NumGetStr(double Num)
        {
            bool   flag1 = false;
            bool   flag2 = true;
            string s1    = "";
            string str1  = "";

            Num = Math.Round(Num, 2);
            if (Num < 0.0)
            {
                return("不转换欠条");
            }
            if (Num > 9999999999999.99)
            {
                return("很难想象谁会有这么多钱!");
            }
            if (Num == 0.0)
            {
                return(NumGetString.Ls_ShZ[0]);
            }
            if (Num < 1.0)
            {
                flag2 = false;
            }
            string str2 = Num.ToString();
            string Rstr = str2;

            if (Rstr.Contains("."))
            {
                Rstr  = str2.Substring(0, str2.IndexOf("."));
                s1    = str2.Substring(str2.IndexOf(".") + 1, str2.Length - str2.IndexOf(".") - 1);
                flag1 = true;
            }
            if (s1 == "" || int.Parse(s1) <= 0)
            {
                flag1 = false;
            }
            if (flag2)
            {
                string str3 = NumGetString.Reversion_Str(Rstr);
                for (int startIndex = 0; startIndex < str3.Length; ++startIndex)
                {
                    string s2 = str3.Substring(startIndex, 1);
                    if (int.Parse(s2) != 0)
                    {
                        str1 = NumGetString.Ls_ShZ[int.Parse(s2)] + NumGetString.Ls_DW_Zh[startIndex] + str1;
                    }
                    else if (startIndex == 0 || startIndex == 4 || startIndex == 8)
                    {
                        if (str3.Length <= 8 || startIndex != 4)
                        {
                            str1 = NumGetString.Ls_DW_Zh[startIndex] + str1;
                        }
                    }
                    else if (int.Parse(str3.Substring(startIndex - 1, 1)) != 0)
                    {
                        str1 = NumGetString.Ls_ShZ[int.Parse(s2)] + str1;
                    }
                }
                if (!flag1)
                {
                    return(str1 + "整");
                }
            }
            for (int startIndex = 0; startIndex < s1.Length; ++startIndex)
            {
                string s2 = s1.Substring(startIndex, 1);
                if (int.Parse(s2) != 0)
                {
                    str1 = str1 + NumGetString.Ls_ShZ[int.Parse(s2)] + NumGetString.Ls_DW_X[startIndex];
                }
                else if (startIndex != 1 && flag2)
                {
                    str1 += NumGetString.Ls_ShZ[int.Parse(s2)];
                }
            }
            return(str1);
        }