CheckHelper/CheckNameHelper.cs
(完整代码) 1017Busing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Utils.CheckHelper
{
public static class CheckNameHelper
{
/// <summary>
/// 文件或文件夹名称
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static bool CheckFileOrDirectory(string name)
{
bool isValid = true;
string[] strList = new string[] { " ", "/", "\"", @"\", @"\/", ":", "*", "?", "<", ">", "|", "\r\n" };
if (string.IsNullOrEmpty(name))
{
isValid = false;
}
else
{
foreach (string errStr in strList)
{
if (name.Contains(errStr))
{
isValid = false;
break;
}
}
}
return isValid;
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。