Advertisement
tolikpunkoff

detect cyrillic letters in string (Regexp)

Nov 3rd, 2021
1,211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. //detect cyrillic letters in string (Regexp)
  2.  
  3.         //cyrillic letters
  4.         public static bool ContainsRus(string TestString)
  5.         {
  6.             return
  7.                 Regex.IsMatch(TestString, @"[а-я]", RegexOptions.IgnoreCase);
  8.         }
  9.  
  10.         //cyrillic letters and spaces
  11.         public static bool ContainsRusOrSpace(string TestString)
  12.         {
  13.             return
  14.                 Regex.IsMatch(TestString, @"[а-я]|\s", RegexOptions.IgnoreCase);
  15.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement