public override bool ContainsAny(string text) { bool r = false; search(text, (keyword, ch, end) => { r = !isInEnglishOrInNumber(keyword, ch, end, text); return(r); }); if (r) { return(true); } var searchText = WordsHelper.ToSenseIllegalWords(text); search(searchText, (keyword, ch, end) => { r = !isInEnglishOrInNumber(keyword, ch, end, searchText); return(r); }); if (r) { return(true); } searchText = WordsHelper.RemoveNontext(searchText); search(searchText, (keyword, ch, end) => { r = !isInEnglishOrInNumber(keyword, ch, end, searchText); return(r); }); return(r); }
public override IllegalWordsSearchResult FindFirst(string text) { IllegalWordsSearchResult result = null; search(text, (keyword, ch, end) => { var start = end + 1 - keyword.Length; result = GetIllegalResult(keyword, ch, start, end, text, text); return(result != null); }); if (result != null) { return(result); } var searchText = WordsHelper.ToSenseIllegalWords(text); search(searchText, (keyword, ch, end) => { var start = end + 1 - keyword.Length; result = GetIllegalResult(keyword, ch, start, end, text, searchText); return(result != null); }); if (result != null) { return(result); } searchText = WordsHelper.RemoveNontext(searchText); search(searchText, (keyword, ch, end) => { var start = end; for (int i = 0; i < keyword.Length; i++) { var n = searchText[start--]; while (n == 1) { n = searchText[start--]; } } start++; result = GetIllegalResult(keyword, ch, start, end, text, searchText); return(result != null); }); if (result != null) { return(result); } return(IllegalWordsSearchResult.Empty); }
public override List <IllegalWordsSearchResult> FindAll(string text) { List <IllegalWordsSearchResult> newlist = new List <IllegalWordsSearchResult>(); string searchText = WordsHelper.ToSenseIllegalWords(text); searchAll(searchText, (keyword, ch, end) => { var start = end + 1 - keyword.Length; var r = GetIllegalResult(keyword, ch, start, end, text, searchText); if (r != null) { newlist.Add(r); } }); searchText = removeChecks(searchText, newlist); //list.AddRange(newlist); //newlist.Clear(); searchText = WordsHelper.RemoveNontext(searchText); searchAll(searchText, (keyword, ch, end) => { var start = end; for (int i = 0; i < keyword.Length; i++) { var n = searchText[start--]; while (n == 1) { n = searchText[start--]; } } start++; var r = GetIllegalResult(keyword, ch, start, end, text, searchText); if (r != null) { newlist.Add(r); } }); return(newlist); }