Skip to content

Commit e1ee149

Browse files
committed
[修改]1. 修改命名规则的正则表达式
1 parent db2b63c commit e1ee149

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ProtoExport/Utility.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ internal static class Utility
88

99
public static readonly string[] splitNotesChars = { "//" };
1010

11+
/// <summary>
12+
/// 定义正则表达式来匹配以大写字母开头,不允许全部由大写字母组成,不允许存在连续的大写字母,并允许后续字符是小写字母或数字
13+
/// </summary>
14+
public const string CamelCasePattern = @"^(?![A-Z]+$)(?!.*[A-Z]{2})[A-Z][a-zA-Z0-9]*$";
1115

1216
/// <summary>
1317
///
@@ -16,10 +20,7 @@ internal static class Utility
1620
/// <returns></returns>
1721
public static bool IsCamelCase(string str)
1822
{
19-
// 定义一个正则表达式来匹配 Upper Camel Case 命名规则
20-
string pattern = @"^[A-Z][a-zA-Z]*$";
21-
22-
return Regex.IsMatch(str, pattern);
23+
return Regex.IsMatch(str, CamelCasePattern);
2324
}
2425

2526
public static string ConvertType(string type)

0 commit comments

Comments
 (0)