String ss = "['气虚质', '痰湿质', '湿热质']";怎么把里面的三个单词取出来存一个数组里面
String s="['气虚质', '痰湿质', '湿热质']";
String[] result=null;
String ss=s.substring(2,s.length()-2);
result = ss.split("', '");
public class Test1 {
public static void main(String[] args) {
String ss = "['气虚质','痰湿质','湿热质']".replace("'", "").replace("[", "").replace("]", "");;
String[] arr = ss.split(",");
for(int i=0;i<arr.length;i++){
System.out.println(arr[i]);
}
}
}
String[] words = Arrays.copyOfRange(ss.split("[\\p{Punct}\\s]+"), 1, 4);