/// <summary>
/// 是否为文本类型
/// </summary>
/// <param name="fileType">File.ContentType</param>
/// <returns></returns>
public static bool IsTxt(string fileType)
{
return (fileType.ToLower() == getFileType(".txt"));
}
/// <summary>
/// 人民币小写转为大写,可处理的最大单位为十亿
/// </summary>
/// <param name="rmb">rmb</param>
/// <returns></returns>
public static string MoneyLowerToUpper(double rmb)
{
string[] textArray = new string[] { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
string text = string.Format("{0:F2}", rmb);
string text2 = "";
if (rmb < 0)
{
text2 = "负";
}
text = text.Replace(".", "").Replace(",", "").Replace("-", "");
for (int i = 0; i < text.Length; i++)
{
int index = text[i] - '0';
string text3 = textArray[index];
switch ((text.Length - i))
{
case 1:
text2 = text2 + text3 + "分";
break;
case 2:
text2 = text2 + text3 + "角";
break;
case 3:
text2 = text2 + text3 + "元";
break;
case 4:
text2 = text2 + text3 + "拾";
break;
case 5:
text2 = text2 + text3 + "佰";
break;
case 6:
text2 = text2 + text3 + "仟";
break;
case 7:
text2 = text2 + text3 + "万";
break;
case 8:
text2 = text2 + text3 + "拾";
break;
case 9:
text2 = text2 + text3 + "佰";
break;
case 10:
text2 = text2 + text3 + "仟";
break;
case 11:
text2 = text2 + text3 + "亿";
break;
case 12:
text2 = text2 + text3 + "拾";
break;
}
}
return text2;
}
/// <summary>
/// 用于将长字串缩短到前4位,后加..(例如:珠海葆力有限公司,加了之后为:珠海葆力.. )
/// </summary>
/// <param name="txt">sour</param>
/// <returns>后加..</returns>
private string getShortName(string txt)
{
string objText =txt;
if ( txt.Length > 4)
{
objText = txt.Substring(0,4) + "..";
}
return objText;
}
/// <summary>
/// 对html编码eg < < , > >
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
private string encodeHTML(string str)
{
str = str.Replace("<","<");
str = str.Replace(">",">");
return str;
}
/// <summary>
/// 对html解码eg < <, > > encodeHTML的反操作
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
private string decodeHTML(string str)
{
str = str.Replace("<","<");
str = str.Replace(">",">");
return str;
}
/// <summary>
/// 对html进行安全编码eg < < , > >
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
private string safeHTML(string str)
{
str = str.Replace("<","<");
str = str.Replace(">","<");
return str;
}
/// <summary>
/// 对html进行安全解码eg << , >> safeHTML的反操作
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
private string unsafeHTML(string str)
{
str = str.Replace("<","<");
str = str.Replace("<",">");
return str;
}
/// 是否为文本类型
/// </summary>
/// <param name="fileType">File.ContentType</param>
/// <returns></returns>
public static bool IsTxt(string fileType)
{
return (fileType.ToLower() == getFileType(".txt"));
}
/// <summary>
/// 人民币小写转为大写,可处理的最大单位为十亿
/// </summary>
/// <param name="rmb">rmb</param>
/// <returns></returns>
public static string MoneyLowerToUpper(double rmb)
{
string[] textArray = new string[] { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
string text = string.Format("{0:F2}", rmb);
string text2 = "";
if (rmb < 0)
{
text2 = "负";
}
text = text.Replace(".", "").Replace(",", "").Replace("-", "");
for (int i = 0; i < text.Length; i++)
{
int index = text[i] - '0';
string text3 = textArray[index];
switch ((text.Length - i))
{
case 1:
text2 = text2 + text3 + "分";
break;
case 2:
text2 = text2 + text3 + "角";
break;
case 3:
text2 = text2 + text3 + "元";
break;
case 4:
text2 = text2 + text3 + "拾";
break;
case 5:
text2 = text2 + text3 + "佰";
break;
case 6:
text2 = text2 + text3 + "仟";
break;
case 7:
text2 = text2 + text3 + "万";
break;
case 8:
text2 = text2 + text3 + "拾";
break;
case 9:
text2 = text2 + text3 + "佰";
break;
case 10:
text2 = text2 + text3 + "仟";
break;
case 11:
text2 = text2 + text3 + "亿";
break;
case 12:
text2 = text2 + text3 + "拾";
break;
}
}
return text2;
}
/// <summary>
/// 用于将长字串缩短到前4位,后加..(例如:珠海葆力有限公司,加了之后为:珠海葆力.. )
/// </summary>
/// <param name="txt">sour</param>
/// <returns>后加..</returns>
private string getShortName(string txt)
{
string objText =txt;
if ( txt.Length > 4)
{
objText = txt.Substring(0,4) + "..";
}
return objText;
}
/// <summary>
/// 对html编码eg < < , > >
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
private string encodeHTML(string str)
{
str = str.Replace("<","<");
str = str.Replace(">",">");
return str;
}
/// <summary>
/// 对html解码eg < <, > > encodeHTML的反操作
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
private string decodeHTML(string str)
{
str = str.Replace("<","<");
str = str.Replace(">",">");
return str;
}
/// <summary>
/// 对html进行安全编码eg < < , > >
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
private string safeHTML(string str)
{
str = str.Replace("<","<");
str = str.Replace(">","<");
return str;
}
/// <summary>
/// 对html进行安全解码eg << , >> safeHTML的反操作
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
private string unsafeHTML(string str)
{
str = str.Replace("<","<");
str = str.Replace("<",">");
return str;
}