相关方法扩展
/// <summary>/// string 擴展/// </summary>public static class StringExtends{/// <summary>/// 用于防止XSS的字符串轉(zhuǎn)義/// </summary>/// <param name="txt"></param>/// <returns></returns>public static string SRUrlEncode(this string txt){if (string.IsNullOrWhiteSpace(txt)){return txt;}return StringEncode.HtmlEncode(HttpUtility.UrlDecode(txt));}/// <summary>/// 判斷字符串是否為空(null)或是內(nèi)容為空/// </summary>/// <param name="str"></param>/// <returns></returns>public static bool IsNullOrEmpty(this string str){return string.IsNullOrEmpty(str);}} View Code
?
轉(zhuǎn)載于:https://www.cnblogs.com/donchen/p/4971190.html
總結(jié)
- 上一篇: js 单引号和双引号的使用注意事项
- 下一篇: iOS xocde编译报错 NSObj