洪城义警-正式版后台
zengh
2022-05-26 4310c19a73f960dfd79c90cfe960cf564b068f72
src/main/java/org/springblade/modules/words/DemoApplication.java
@@ -7,9 +7,7 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Stream;
@@ -17,9 +15,12 @@
   public static void main(String[] args) throws Exception {
      test_StringSearch();
      test_WordsSearch();
//      test_StringSearch();
//      test_WordsSearch();
      Map content = new HashMap();
      content = interceptWords("nihoahsodahioda美国,大萨达日本");
      System.out.println(content);
//      test_StringSearchEx();
//      test_WordsSearchEx();
//
@@ -55,7 +56,7 @@
//      test_issues_74();
   }
   public static String interceptWords(String content) {
   public static Map interceptWords(String content) {
      List<String> list = new ArrayList<String>();
      list.add("美国");
      list.add("日本");
@@ -64,10 +65,15 @@
      StringSearch iwords = new StringSearch();
      iwords.SetKeywords(list);
//      boolean b = iwords.ContainsAny(test);
//      if (b == false) {
//         System.out.println("ContainsAny is Error.");
//      }
      Map res = new HashMap();
      boolean b = iwords.ContainsAny(content);
      if (b == false) {
         System.out.println("ContainsAny is Error.");
      }
      res.put("iswords",String.valueOf(b));
//
//      String f = iwords.FindFirst(test);
//      if (f != "中国") {
@@ -89,7 +95,22 @@
      if (str.equals("我是***") == false) {
         System.out.println("Replace is Error.");
      }
      return str;
      res.put("content",str);
      String text = "";
      List<String> all = iwords.FindAll(content);
      for (int i = 0; i < all.size(); i++) {
         text += all.get(i) + ",";
      }
      String words = "";
      if(!text.equals("")){
         words = text.substring(0,text.length()-1);
      }
      res.put("words",words);
      return res;
   }
   public static void test_StringSearch() {