| | |
| | | // test_issues_74(); |
| | | } |
| | | |
| | | private static void test_StringSearch() { |
| | | public static String interceptWords(String content) { |
| | | List<String> list = new ArrayList<String>(); |
| | | list.add("美国"); |
| | | list.add("日本"); |
| | | System.out.println("StringSearch run Test."); |
| | | |
| | | StringSearch iwords = new StringSearch(); |
| | | iwords.SetKeywords(list); |
| | | |
| | | // boolean b = iwords.ContainsAny(test); |
| | | // if (b == false) { |
| | | // System.out.println("ContainsAny is Error."); |
| | | // } |
| | | // |
| | | // String f = iwords.FindFirst(test); |
| | | // if (f != "中国") { |
| | | // System.out.println("FindFirst is Error."); |
| | | // } |
| | | // |
| | | // List<String> all = iwords.FindAll(test); |
| | | // if (all.get(0) != "中国") { |
| | | // System.out.println("FindAll is Error."); |
| | | // } |
| | | // if (all.get(1) != "国人") { |
| | | // System.out.println("FindAll is Error."); |
| | | // } |
| | | // if (all.size() != 2) { |
| | | // System.out.println("FindAll is Error."); |
| | | // } |
| | | |
| | | String str = iwords.Replace(content, '*'); |
| | | if (str.equals("我是***") == false) { |
| | | System.out.println("Replace is Error."); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | public static void test_StringSearch() { |
| | | String test = "我是中国人"; |
| | | List<String> list = new ArrayList<String>(); |
| | | list.add("中国"); |