足力健后端,使用.netcore版本,合并1个项目使用

DateInterval.cs 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Web;
  5. namespace Utility
  6. {
  7. public enum DateInterval
  8. {
  9. Second, Minute, Hour, Day, Week, Month, Quarter, Year
  10. }
  11. /// <summary>
  12. /// 网页字符串专用类
  13. /// </summary>
  14. public class WebString
  15. {
  16. /// <summary>
  17. /// 获取邮件@后的部分
  18. /// </summary>
  19. /// <param name="strEmail"></param>
  20. /// <returns></returns>
  21. public static string GetEmailHostName(string strEmail)
  22. {
  23. if (strEmail.IndexOf("@", System.StringComparison.Ordinal) < 0)
  24. {
  25. return "";
  26. }
  27. return strEmail.Substring(strEmail.LastIndexOf("@", System.StringComparison.Ordinal)).ToLower();
  28. }
  29. /// <summary>
  30. /// 返回 HTML 字符串的编码结果
  31. /// </summary>
  32. /// <param name="str">字符串</param>
  33. /// <returns>编码结果</returns>
  34. public static string HtmlEncode(string str)
  35. {
  36. return HttpUtility.HtmlEncode(str);
  37. }
  38. /// <summary>
  39. /// 返回 HTML 字符串的解码结果
  40. /// </summary>
  41. /// <param name="str">字符串</param>
  42. /// <returns>解码结果</returns>
  43. public static string HtmlDecode(string str)
  44. {
  45. return HttpUtility.HtmlDecode(str);
  46. }
  47. /// <summary>
  48. /// 返回 URL 字符串的编码结果
  49. /// </summary>
  50. /// <param name="str">字符串</param>
  51. /// <returns>编码结果</returns>
  52. public static string UrlEncode(string str)
  53. {
  54. return HttpUtility.UrlEncode(str);
  55. }
  56. /// <summary>
  57. /// 返回 URL 字符串的编码结果
  58. /// </summary>
  59. /// <param name="str">字符串</param>
  60. /// <returns>解码结果</returns>
  61. public static string UrlDecode(string str)
  62. {
  63. return HttpUtility.UrlDecode(str);
  64. }
  65. }
  66. }