public static void FloatTransform(string strNum,ref string result)
{
string strInt;
string strFloat;
strInt=strNum.Substring(0,strNum.IndexOf(".",0));//整数部分的值
strFloat=strNum.Substring((strNum.IndexOf(".",0)+1),(strNum.Length-strNum.IndexOf(".",0)-1));//小数部分的值
//MessageBox.Show(strInt);
//MessageBox.Show(strFloat);
//return;
int numLen=strInt.Length;
string dx="零壹贰叁肆伍陆柒捌玖";
string ws="分角元拾佰仟万拾佰仟亿拾佰仟";
//MessageBox.Show(ws.Length.ToString());
result=null;
int i=0,w=0;
int q=0;
bool ling=true;
//计算整数的大写!
while(i<numLen)
{
if(strInt.Substring(i,1)!="0")
{
//MessageBox.Show(strNum.Substring(i,1));
result=result+dx.Substring(Convert.ToInt32(strInt.Substring(i,1)),1);
result=result+ws.Substring((numLen-i)+1,1);
ling=false;
i++;
}
else if(ling==false&&strInt.Substring(i,1)=="0")
{
if((numLen-i+1)>10)//判断是否过亿
{
w=0;
for(q=11;q<(numLen-i+1);q++)
{
w=w+Convert.ToInt32(strInt.Substring(numLen-q+1,1));
}
if(w==0)
{
result=result+"亿";
i=numLen-9;
}
else
{
result=result+"零";
i=i+1;
ling=true;
}
}
else if((numLen-i+1)>6)//判断是否是万以上
{
w=0;
for(q=1;q<(numLen-i+1);q++)
{
w=w+Convert.ToInt32(strInt.Substring(numLen-q,1));
}
if(w==0)
{
result=result+"整";
i=numLen+1;
}
else
{
result=result+"零";
i=i+1;
ling=true;
}
}
else if((numLen-i+1)>3)
{
w=0;
for(q=1;q<(numLen-i+1);q++)
{
w=w+Convert.ToInt32(strInt.Substring(numLen-q,1));
}
if(w==0)
{
result=result+"整";
i=numLen+1;
}
else
{
result=result+"零";
i=i+1;
ling=true;
}
}
else if((numLen-i+1)>0)
{
w=0;
for(q=1;q<(numLen-i+1);q++)
{
w=w+Convert.ToInt32(strInt.Substring(numLen-q,1));
}
if(w==0)
{
result=result+"整";
i=numLen+1;
}
else
{
result=result+"零";
i=i+1;
ling=true;
}
}
}
else if(strInt.Substring(i,1)=="0"&&ling==true)
{
i=i+1;
}
}
//计算小数部分的大写!
int numLenFlt=strFloat.Length;
if(strFloat.Substring(0,1)=="0"&&strFloat.Substring(1,1)=="0")
{
result=result+"整";
}
else if(strFloat.Substring(0,1)!="0"&&strFloat.Substring(1,1)=="0")
{
result=result+dx.Substring(Convert.ToInt32(strFloat.Substring(0,1)),1)+"角";
}
else if(strFloat.Substring(0,1)=="0"&&strFloat.Substring(1,1)!="0")
{
result=result+dx.Substring(Convert.ToInt32(strFloat.Substring(1,1)),1)+"分";
}
else if(strFloat.Substring(0,1)!="0"&&strFloat.Substring(1,1)!="0")
{
result=result+dx.Substring(Convert.ToInt32(strFloat.Substring(0,1)),1)+"角"+dx.Substring(Convert.ToInt32(strFloat.Substring(1,1)),1)+"分";
}
}