public static string getNumStr(int num)
{
string strnum = string.Empty;
int temp_num = num;
bool has_0 = false;
//千
int temp_qian = temp_num / 1000;
if(temp_qian > 0)
{
strnum += getNumStr(temp_qian);
strnum += getSingleNumStr(1000);
}
temp_num = temp_num % 1000;
//百
int temp_bai = temp_num / 100;
if(temp_bai > 0)
{
strnum += getSingleNumStr(temp_bai);
strnum += getSingleNumStr(100);
}
else if(temp_qian > 0)
{
has_0 = true;
}
temp_num = temp_num % 100;
//十
int temp_shi = temp_num / 10;
if(temp_shi > 0)
{
if(has_0)
{
strnum += getSingleNumStr(0);
has_0 = false;
}
if(temp_shi != 1)
strnum += getSingleNumStr(temp_shi);
strnum += getSingleNumStr(10);
}
else
{
if(temp_bai > 0)
has_0 = true;
}
temp_num = temp_num % 10;
if(temp_num > 0)
{
if(has_0)
{
strnum += getSingleNumStr(0);
has_0 = false;
}
strnum += getSingleNumStr(temp_num);
}
return strnum;
}
private static string getSingleNumStr(int num)
{
string str_id = "";
switch(num)
{
case 0:
str_id = "txt_0";//零
break;
case 1:
str_id = "txt_1";//一
break;
case 2:
str_id = "txt_2";//二
break;
case 3:
str_id = "txt_3";//三
break;
case 4:
str_id = "txt_4";//四
break;
case 5:
str_id = "txt_5";//五
break;
case 6:
str_id = "txt_6";//六
break;
case 7:
str_id = "txt_7";//七
break;
case 8:
str_id = "txt_8";//八
break;
case 9:
str_id = "txt_9";//九
break;
case 10:
str_id = "txt_10";//十
break;
case 100:
str_id = "txt_100";//百
break;
case 1000:
str_id = "txt_1000";//千
break;
case 10000:
str_id = "txt_10000";//万
break;
default:
break;
}
return StringManager.GetInstance ().GetValueEx (str_id);// 这里是获取大写(一,二,三,四,五,六,七,八,九,十,零等方法)
}