void displayResult() {
String str = "tamilnadu||chennai-karanataka||bengaluru";
String[] res = str.split("\\-");
System.out.println(res.length);//res length is 2
//res contains two strings splited by -
String[] result = res.toString().split("\\||");
//again splitting by || but getting as characters, i need to get word by word
// how to achieve this
System.out.println(result.length);//result length is 28
}
// i was supposed to get tamilnadu and chennai from first string[] res
String [] res包含两个被拆分的字符串-我试图以相同的方式拆分res以使字符串被||拆分 管道符号,但我越来越像字符一样如何获得像以前一样
森林海
守着星空守着你
慕尼黑8549860
相关分类