驗證管理類目

2021-08-07 10:23:08 字數 3211 閱讀 7952

using system.text.regularexpressions;

namespace commons.helpers

#endregion

#region 驗證是否為正整數

/// /// 驗證是否為正整數

///

///

///

public static bool isint(string str)

#endregion

#region 驗證是否符合email格式

/// /// 驗證是否符合email格式

///

/// 要判斷的email字串

/// 判斷結果

public static bool isvalidemail(string stremail)

public static bool isvaliddoemail(string stremail)

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

}#endregion

#region 驗證是否是正確的url

/// /// 驗證是否是正確的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\.\,\?\'\\\+&%\$#\=~_\-]+))*$");

}#endregion

#region 驗證是否為ip

/// /// 驗證是否為ip

///

///

///

public static bool isip(string ip)

(2[0-4]\d|25[0-5]|[01]?\d\d?)$");

}public static bool isipsect(string ip)

((2[0-4]\d|25[0-5]|[01]?\d\d?|\*)\.)(2[0-4]\d|25[0-5]|[01]?\d\d?|\*)$");

}#endregion

#region 驗證是否為手機號碼

/// /// 驗證是否為手機號碼

///

///

///

public static bool ishandset(string handset)

");}

#endregion

#region 驗證是否為身份證號碼

/// /// 驗證是否為身份證號碼

///

///

///

public static bool isidcard(string idcard)

$)|(^\d$)");

}#endregion

#region 驗證是否是時間格式

/// /// 驗證是否是時間格式

///

///

public static bool istime(string timeval)

#endregion

#region 檢測是否有sql危險字元

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

///

/// 要判斷字串

/// 判斷結果

public static bool issafesqlstring(string str)

|\#endregion

#region 判斷是否為base64字串

/// /// 判斷是否為base64字串

///

///

///

public static bool isbase64string(string str)

#endregion

#region 返回指定ip是否在指定的ip陣列所限定的範圍內

/// /// 返回指定ip是否在指定的ip陣列所限定的範圍內, ip陣列內的ip位址可以使用*表示該ip段任意, 例如192.168.1.*

///

///

///

///

public static bool iniparray(string ip, string iparray)

if (userip.length > i)

else

}else

}if (r == 4)

}return false;

}#endregion

#region 判斷字串是否是yy-mm-dd字串

/// /// 判斷字串是否是yy-mm-dd字串

///

/// 待判斷字串

/// 判斷結果

public static bool isdatestring(string str)

)-(\d)-(\d)");

}#endregion

#region 驗證是否符合副檔名要求

/// /// 驗證是否符合副檔名要求

///

/// 副檔名字串

/// 檔名

/// 判斷結果

public static bool isvalidfileextensions(string extensions, string filename)

)$", extensions.replace(',', '|'));

regex reg = new regex(strpattern, regexoptions.cultureinvariant | regexoptions.ignorecase);

return reg.ismatch(filename);

}#endregion

}}

驗證資料工具類目

using system.text.regularexpressions namespace commons.helpers endregion region 驗證是否為正整數 驗證是否為正整數 public static bool isint string str endregion region...

管理類命令

管理類命令 hostname 顯示主機名稱 uname顯示系統資訊 top 顯示當前系統中耗費資源最多的程序 ps 顯示瞬間的程序狀態 du 顯示指定的檔案 目錄 已使用的磁碟空間的總量 df 顯示檔案系統磁碟空間的使用情況 free 顯示當前記憶體和交換空間的使用情況 ifconfig 顯示網路介...

管理類聯考

管理類聯考 數學 問題求解15題 條件充分性判斷10題,每題3分 共75分 高中 初中 小學數學知識的運用 邏輯推理 30題,每題2分 共60分 形式推理 論證推理 綜合推理 寫作論證有效性分析1題30分 論說文1題35分 共65分 論證有效性分析 較快地找出一段論證中的漏洞 論說文良好的議 寫作能...