using
System;
using
System.Data;
using
System.Configuration;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
System.IO;
using
System.Text;
/**/
///
<summary>
///
Convert 的摘要说明。
///
</summary>
public
class
ToDaXie
{
public
ToDaXie()
{
//
//
TODO: 在此处添加构造函数逻辑
//
}
private
static
string
[] cstr
=
{
"
零
"
,
"
壹
"
,
"
贰
"
,
"
叁
"
,
"
肆
"
,
"
伍
"
,
"
陆
"
,
"
柒
"
,
"
捌
"
,
"
玖
"
};
private
static
string
[] wstr
=
{
""
,
"
圆
"
,
"
拾
"
,
"
佰
"
,
"
仟
"
,
"
萬
"
,
"
拾
"
,
"
佰
"
,
"
仟
"
,
"
億
"
,
"
拾
"
,
"
佰
"
,
"
仟
"
};
private
static
string
[] samll
=
{
""
,
"
分
"
,
"
角
"
};
/**/
///
<summary>
///
转换大写人民币.
///
</summary>
///
<param name="str"></param>
///
<returns></returns>
public
static
string
ConvertInt(
string
str)
{
string
[] AllStr
=
str.Split(
'
.
'
);
int
len
=
AllStr[
0
].Length;
int
i;
string
tmpstr, rstr;
rstr
=
""
;
//
从1开始.
for
(i
=
1
; i
<=
len; i
++
)
{
tmpstr
=
AllStr[
0
].Substring(len
-
i,
1
);
rstr
+=
string
.Concat(wstr[i]
+
cstr[Convert.ToInt32(tmpstr)]);
}
//
倒排.
StringBuilder sb
=
new
StringBuilder();
for
(i
=
rstr.Length
-
1
; i
>=
0
; i
--
)
{
sb.Append(rstr[i]);
}
rstr
=
sb.ToString();
rstr
=
rstr.Replace(
"
拾零
"
,
"
拾
"
);
rstr
=
rstr.Replace(
"
零拾
"
,
""
);
rstr
=
rstr.Replace(
"
零佰
"
,
""
);
rstr
=
rstr.Replace(
"
零仟
"
,
""
);
rstr
=
rstr.Replace(
"
零萬
"
,
"
萬
"
);
if
(AllStr[
1
]
==
""
)
{
return
"
¥
"
+
rstr
+
"
整
"
;
}
else
{
string
Arstr
=
""
;
string
strr
=
AllStr[
1
].Substring(
0
,
2
);
string
tmpstra
=
""
;
for
(i
=
1
; i
<=
2
; i
++
)
{
tmpstra
=
strr.Substring(
2
-
i,
1
);
Arstr
+=
string
.Concat(samll[i]
+
cstr[Convert.ToInt32(tmpstra)]);
}
//
倒排.
StringBuilder sba
=
new
StringBuilder();
for
(i
=
Arstr.Length
-
1
; i
>=
0
; i
--
)
{
sba.Append(Arstr[i]);
}
Arstr
=
sba.ToString();
return
"
¥
"
+
rstr
+
Arstr;
}
}
}