新增方法
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ZR.Common
|
||||
{
|
||||
@@ -60,5 +61,23 @@ namespace ZR.Common
|
||||
: (diffday / 7)) + 1 + (dayInMonth > firstWeekEndDay ? 1 : 0);
|
||||
return weekNumInMonth;
|
||||
}
|
||||
/// <summary>
|
||||
/// 判断一个字符串是否为url
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsUrl(string str)
|
||||
{
|
||||
try
|
||||
{
|
||||
string Url = @"^http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?$";
|
||||
return Regex.IsMatch(str, Url);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user