private string convertnumber(int number)
{
string[] Ls_ShZ = { "〇", "一", "二", "三", "四", "五", "六", "七", "八", "九" };
string[] Ls_DW_Zh = { "十", "百", "千", "万" };
string str = null;
string str_number = number.ToString();
string[] x = new string[str_number.Length];
for (int i = 0; i < str_number.Length; i++)
{
x[i] = str_number.Substring(i, 1);
}
for (int i = 0; i < x.Length; i++)
{
str =str+ Ls_ShZ[Convert.ToInt32(x[i])];
}
switch (str.Length)
{
case 1:
{
str = str.Substring(0, 1);
}
break;
case 2:
{
str = str.Substring(0, 1) + Ls_DW_Zh[0] + str.Substring(1, 1);
}
break;
case 3:
{
str = str.Substring(0, 1) + Ls_DW_Zh[1] + str.Substring(1, 1) + Ls_DW_Zh[0] + str.Substring(2, 1);
}
break;
case 4:
{
str = str.Substring(0, 1) + Ls_DW_Zh[2] + str.Substring(1, 1) + Ls_DW_Zh[1] + str.Substring(2, 1) + Ls_DW_Zh[0] + str.Substring(3, 1);
}
break;
case 5:
{
str = str.Substring(0, 1) + Ls_DW_Zh[3] + str.Substring(1, 1) + Ls_DW_Zh[2] + str.Substring(2, 1) + Ls_DW_Zh[1] + str.Substring(3, 1) + Ls_DW_Zh[0] + str.Substring(4, 1);
}
break;
default:
str = "";
break;
}
for (int i = 0; i < str.Length;i++ )
{
str = str.Replace("〇十", "〇");
str = str.Replace("〇百", "〇");
str = str.Replace("〇千", "〇");
str = str.Replace("〇万", "〇");
str = str.Replace("〇〇", "〇");
}
for (int i = 0; i < str.Length; i++)
{
if (str.Substring(str.Length - 1, 1) == "〇")
{
str = str.Substring(0, str.Length - 1);
}
}
return str;
}
{
string[] Ls_ShZ = { "〇", "一", "二", "三", "四", "五", "六", "七", "八", "九" };
string[] Ls_DW_Zh = { "十", "百", "千", "万" };
string str = null;
string str_number = number.ToString();
string[] x = new string[str_number.Length];
for (int i = 0; i < str_number.Length; i++)
{
x[i] = str_number.Substring(i, 1);
}
for (int i = 0; i < x.Length; i++)
{
str =str+ Ls_ShZ[Convert.ToInt32(x[i])];
}
switch (str.Length)
{
case 1:
{
str = str.Substring(0, 1);
}
break;
case 2:
{
str = str.Substring(0, 1) + Ls_DW_Zh[0] + str.Substring(1, 1);
}
break;
case 3:
{
str = str.Substring(0, 1) + Ls_DW_Zh[1] + str.Substring(1, 1) + Ls_DW_Zh[0] + str.Substring(2, 1);
}
break;
case 4:
{
str = str.Substring(0, 1) + Ls_DW_Zh[2] + str.Substring(1, 1) + Ls_DW_Zh[1] + str.Substring(2, 1) + Ls_DW_Zh[0] + str.Substring(3, 1);
}
break;
case 5:
{
str = str.Substring(0, 1) + Ls_DW_Zh[3] + str.Substring(1, 1) + Ls_DW_Zh[2] + str.Substring(2, 1) + Ls_DW_Zh[1] + str.Substring(3, 1) + Ls_DW_Zh[0] + str.Substring(4, 1);
}
break;
default:
str = "";
break;
}
for (int i = 0; i < str.Length;i++ )
{
str = str.Replace("〇十", "〇");
str = str.Replace("〇百", "〇");
str = str.Replace("〇千", "〇");
str = str.Replace("〇万", "〇");
str = str.Replace("〇〇", "〇");
}
for (int i = 0; i < str.Length; i++)
{
if (str.Substring(str.Length - 1, 1) == "〇")
{
str = str.Substring(0, str.Length - 1);
}
}
return str;
}