author:mengyao
From:CSdn
据客户要求,把"2007-11-4"转换为"二〇〇七年十一月四号"
using System;
using System.Text;
using System.Text.RegularExpressions;
namespace AndyDateConvert
{
class DateConvert
{
private static DateConvert m_DateConvert = null;
private char strChinese;
private DateConvert()
{
strChinese = new char {
''〇'',''一'',''二'',''三'',''四'',''五'',''六'',''七'',''八'',''九'',''十''
};
}
public static DateConvert Instance
{
get
{
if (m_DateConvert == null)
m_DateConvert = new DateConvert();
return m_DateConvert;
}
}
public string Baodate2Chinese(string strDate)
{
StringBuilder result = new StringBuilder();
// 依据正则表达式判断参数是否正确
Regex theReg = new Regex(@"(d{2}|d{4})(/|-)(d{1,2})(/|-)(d{1,2})");
if (theReg.Match(strDate).Length != 0)
{
// 将数字日期的年月日存到字符数组str中
string str = null;
if (strDate.Contains("-"))
{