C 判斷常見型別格式是否正確的類

2021-08-26 10:15:01 字數 1930 閱讀 7827

//c#判斷常見型別格式是否正確的類

public class gf_isok

///

/// 判斷是否是數字

///

///

///

public static bool isnumber(string strnumber)

///

/// 判斷是否是日期字串

///

///

///

public static bool isdatestr_yyyymmdd(string in_str)

///

/// 判斷是否是日期字串

///

///

///

public static bool isdatestr(string in_str)

catch (formatexception)

return bvalid;

}///

/// 判斷字串中是否包含漢字,有返回true 否則為false

///

///

///

public static bool i***isthanzi(string str)

else

}///

/// 欄位串是否為null或為""(空)

///

///

///

public static bool isstrnullorempty(string str)

///

/// 返回檔案是否存在

///

/// 檔名

/// 是否存在

public static bool isfileexists(string filename)

///

/// 檢測是否符合email格式

///

/// 要判斷的email字串

/// 判斷結果

public static bool isvalidemail(string stremail)

public static bool isvaliddoemail(string stremail)

\.[0-9]\.[0-9]\.)|(([\w-]+\.)+))([a-za-z]|[0-9])(\]?)$");

}///

/// 檢測是否是正確的url

///

/// 要驗證的url

/// 判斷結果

public static bool isurl(string strurl)

[0-9]|[1-9][0-9]|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]|[1-9][0-9]|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]|[1-9][0-9]|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]|[1-9][0-9]|[0-9])|localhost|([a-za-z0-9\-]+\.)*[a-za-z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-za-z]))(\:[0-9]+)*(/($|[a-za-z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*$");

}///

/// 判斷是否為base64字串

///

///

///

public static bool isbase64string(string str)

///

/// 檢測是否有sql危險字元

///

/// 要判斷字串

/// 判斷結果

public static bool issafesqlstring(string str)|\}

C 判斷常見型別格式是否正確的類

c 判斷常見型別格式是否正確的類 public class gf isok 判斷是否是數字 public static bool isnumber string strnumber 判斷是否是日期字串 public static bool isdatestr yyyymmdd string in s...

C 判斷常見型別格式是否正確的類

c 判斷常見型別格式是否正確的類 public class gf isok 判斷是否是數字 public static bool isnumber string strnumber 判斷是否是日期字串 public static bool isdatestr yyyymmdd string in s...

C 判斷常見型別格式是否正確的類

c 判斷常見型別格式是否正確的類 public class gf isok 判斷是否是數字 public static bool isnumber string strnumber 判斷是否是日期字串 public static bool isdatestr yyyymmdd string in s...