#region 设置数据库连接字符串
/// <summary>
/// 设置数据库连接字符串
/// <param name="strConn"></param>
public void setConn(string strDB)
{
this.strConn = getConn(strDB);
}
#endregion
#region 字符串位数截断
public string strCa(string Str, int I)
{
string ReStr = Str;
if (!(Str == "" || Str == null))
{
if (Str.Length > I) ReStr = Str.Substring(0, I);
ReStr = ReStr.Replace("'", "‘");
}
return ReStr;
}
#endregion
#region 字符串去除制表符回车符换行符
public string strChar(string Str)
{
string ReStr = Str;
if (!(Str == "" || Str == null))
{
if (Str.Length > 0) ;
ReStr = Str.Replace("\n", "").Replace("\t", "").Replace("\r", "");
}
return ReStr;
}
#endregion
#region 1个以上的多个空格替换成1个空格
public string GetStrSpace(string strWords)
{
Regex replaceSpace = new Regex(@"\s{1,}", RegexOptions.IgnoreCase);
return replaceSpace.Replace(strWords, " ").Trim();
}
#endregion
#region 判断是否数字
public bool IsNumberic(string strNum)
{
try
{
//this.wteLog("", false, "测试" + strNum);
Decimal i = System.Convert.ToDecimal(strNum);
//this.wteLog("", false, "测试True" + i);
return true;
}
catch (System.Exception ex)
{
this.wteLog("", false, "" + ex.Message);
//this.wteLog("", false, "测试NO");
return false;
}
}
#endregion
|