工作记录
public class test {
public static List<String> Spilt(String s){
int i = 0;
List<String> output = new ArrayList<>();
String pattern = "\\(([^\\)]+)\\)";
Matcher matcher = Pattern.compile(pattern).matcher(s);
while (matcher.find()) {
String temp = matcher.group(1);
output.add(temp);
}
return output;
}
public static void main(String[] args) {
String input = "test data (测试)(data)";
String s;
List<String> temp1 = new ArrayList<>();
if(input.contains("(")) {
temp1 = Spilt(input);
for(String a : temp1){
s = a;
System.out.println(a);
}
}
System.out.println(temp1);
}
}