Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 4c7afb6

Browse files
committed
Add IsValidVarName ext method
1 parent 268b3f3 commit 4c7afb6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/ServiceStack.Text/StringExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,8 @@ public static bool ContainsAny(this string text, params string[] testMatches)
918918
return false;
919919
}
920920

921+
public static bool IsValidVarName(this string name) => InvalidVarCharsRegex.IsMatch(name);
922+
921923
public static string SafeVarName(this string text) => !string.IsNullOrEmpty(text)
922924
? InvalidVarCharsRegex.Replace(text, "_") : null;
923925

0 commit comments

Comments
 (0)