Exemplo n.º 1
0
        private static string FullLen(string strSend)
        {
            bool   flag        = false;
            string str1        = "";
            string str2        = strSend.Trim();
            int    startIndex1 = str2.Length - 9;
            int    length      = 0;

            if (strSend.Trim() == "")
            {
                return(MoneyToWords.Len1("0"));
            }
            for (int startIndex2 = 0; startIndex2 < str2.Length && !(str2.Substring(startIndex2, 1) != "0"); ++startIndex2)
            {
                if (startIndex2 == str2.Length - 1)
                {
                    return(MoneyToWords.strNumber[0]);
                }
            }
            int num = 0;

            while (strSend.Trim().Substring(num++, 1) == "0")
            {
                str2 = str2.Remove(0, 1);
            }
            if (str2.Length < 9)
            {
                length = str2.Length;
            }
            MoneyToWords.strMainGroup = (uint)(str2.Length % 9) <= 0U ? new string[str2.Length / 9] : new string[str2.Length / 9 + 1];
            for (int index = MoneyToWords.strMainGroup.Length - 1; index >= 0; --index)
            {
                if (startIndex1 >= 0)
                {
                    length = startIndex1;
                    MoneyToWords.strMainGroup[index] = str2.Substring(startIndex1, 9);
                    startIndex1 -= 9;
                }
                else
                {
                    MoneyToWords.strMainGroup[index] = str2.Substring(0, length);
                }
            }
            for (int index1 = 0; index1 < MoneyToWords.strMainGroup.Length; ++index1)
            {
                int startIndex2 = MoneyToWords.strMainGroup[index1].Length - 3;
                if (MoneyToWords.strMainGroup[index1].Length < 3)
                {
                    length = MoneyToWords.strMainGroup[index1].Length;
                }
                MoneyToWords.strSubGroup = (uint)(MoneyToWords.strMainGroup[index1].Length % 3) <= 0U ? new string[MoneyToWords.strMainGroup[index1].Length / 3] : new string[MoneyToWords.strMainGroup[index1].Length / 3 + 1];
                for (int index2 = MoneyToWords.strSubGroup.Length - 1; index2 >= 0; --index2)
                {
                    if (startIndex2 >= 0)
                    {
                        length = startIndex2;
                        MoneyToWords.strSubGroup[index2] = MoneyToWords.strMainGroup[index1].Substring(startIndex2, 3);
                        startIndex2 -= 3;
                    }
                    else
                    {
                        MoneyToWords.strSubGroup[index2] = MoneyToWords.strMainGroup[index1].Substring(0, length);
                    }
                }
                for (int index2 = 0; index2 < MoneyToWords.strSubGroup.Length; ++index2)
                {
                    flag = false;
                    if (index1 == MoneyToWords.strMainGroup.Length - 1 && index2 == MoneyToWords.strSubGroup.Length - 1)
                    {
                        str1 = MoneyToWords.strSubGroup[index2].Length >= 3 ? str1 + MoneyToWords.Len3(MoneyToWords.strSubGroup[index2]) : (MoneyToWords.strSubGroup[index2].Length != 1 ? str1 + MoneyToWords.Len2(MoneyToWords.strSubGroup[index2]) : str1 + MoneyToWords.Len1(MoneyToWords.strSubGroup[index2]));
                    }
                    else if (MoneyToWords.strSubGroup[index2].Length < 3)
                    {
                        str1 = MoneyToWords.strSubGroup[index2].Length != 1 ? str1 + MoneyToWords.Len2(MoneyToWords.strSubGroup[index2]) + " " : str1 + MoneyToWords.Len1(MoneyToWords.strSubGroup[index2]) + " ";
                    }
                    else if (MoneyToWords.Len3(MoneyToWords.strSubGroup[index2]) == null)
                    {
                        flag = true;
                    }
                    else
                    {
                        str1 = str1 + MoneyToWords.Len3(MoneyToWords.strSubGroup[index2]) + " ";
                    }
                    if (!flag)
                    {
                        str1 = (uint)(MoneyToWords.strSubGroup.Length - 1 - index2) <= 0U ? str1 + MoneyToWords.strMaxUnit[MoneyToWords.strSubGroup.Length - 1 - index2] + " " : str1 + MoneyToWords.strMaxUnit[MoneyToWords.strSubGroup.Length - 1 - index2] + " ";
                    }
                }
                if (index1 != MoneyToWords.strMainGroup.Length - 1)
                {
                    str1 = flag ? str1.Substring(0, str1.Length - 1) + " " + MoneyToWords.strMaxUnit[3] + " " : str1.Substring(0, str1.Length - 1) + MoneyToWords.strMaxUnit[3] + " ";
                }
            }
            string str3 = str1.Trim();

            if (str3.Substring(str3.Length - 1, 1) == ".")
            {
                str3 = str3.Remove(str3.Length - 1, 1);
            }
            return(str3);
        }
Exemplo n.º 2
0
 private static string Len3(string strA)
 {
     if (strA.Substring(0, 3) == "000")
     {
         return((string)null);
     }
     if (strA.Substring(1, 2) == "00")
     {
         return(MoneyToWords.Len1(strA.Substring(0, 1)) + " " + MoneyToWords.strMinUnit[5]);
     }
     return(MoneyToWords.Len1(strA.Substring(0, 1)) + " " + MoneyToWords.strMinUnit[5] + " " + MoneyToWords.Len2(strA.Substring(1, strA.Length - 1)));
 }