private List <string> CheckText ( [CanBeNull] string text ) { List <string> result = new List <string>(); if (!string.IsNullOrEmpty(text)) { Match match = _mixRegex.Match(text); while (match.Success) { CharacterClass classes = CharacterClassifier .DetectCharacterClasses ( match.Value ); if (CharacterClassifier.IsBothCyrillicAndLatin(classes)) { result.Add(match.Value); } } } return(result); }
public void CharacterClassifier_IsBothCyrillicAndLatin_1() { string text = "Hello, 2128506\r\n"; CharacterClass classes = CharacterClassifier.DetectCharacterClasses(text); Assert.IsFalse(CharacterClassifier.IsBothCyrillicAndLatin(classes)); text = "Привет, 2128506\r\n"; classes = CharacterClassifier.DetectCharacterClasses(text); Assert.IsFalse(CharacterClassifier.IsBothCyrillicAndLatin(classes)); text = "Hello, Привет, 2128506\r\n"; classes = CharacterClassifier.DetectCharacterClasses(text); Assert.IsTrue(CharacterClassifier.IsBothCyrillicAndLatin(classes)); text = "2128506\r\n"; classes = CharacterClassifier.DetectCharacterClasses(text); Assert.IsFalse(CharacterClassifier.IsBothCyrillicAndLatin(classes)); }