using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ToolGood.Words; namespace Common.BlockWord { public static class BlockWordHelper { public static bool IsHaveBlockWord(string text) { if (string.IsNullOrWhiteSpace(text)) return false; StringSearch iwords = new StringSearch(); iwords.SetKeywords(BlockWord.BlockWordValue.Split(',')); return iwords.ContainsAny(text); } public static string ReplaceBlockWord(string text, char replaceChar = '*') { StringSearch iwords = new StringSearch(); iwords.SetKeywords(BlockWord.BlockWordValue.Split(',')); return iwords.Replace(text, replaceChar); } public static List GetBlockWord(string text) { if (string.IsNullOrWhiteSpace(text)) return null; StringSearch iwords = new StringSearch(); iwords.SetKeywords(BlockWord.BlockWordValue.Split(',')); return iwords.FindAll(text); } } }