public static bool CheckFuc(NtionType tionlype, string name, ref string Msg) { switch (tionlype) { case NtionType.Folder: { Regex regex = new Regex('^[a-zA-Z0-9-_]{1,20}$'); if (!regex.IsMatch(name)) { Msg = '文件夹名称不符合系统命名规范,请使用字母、数字、中划线或下划线,长度不超过 20 个字符'; return false; } break; } } return true; }

C# 函数验证文件夹格式和命名规范

原文地址: https://www.cveoy.top/t/topic/ljA6 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录