tolikpunkoff

detect cyrillic letters in string (Regexp)

Nov 3rd, 2021
539
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.         }
RAW Paste Data