在 java 中按字符拆分字符串
我从网上得到一个字符串,看起来像这样:
Latest Episode@04x22^Killing Your Number^May/15/2009
然后我需要存储,并在不同的变量中,但它不起作用。04x22
Killing Your Number
May/15/2009
String[] all = inputLine.split("@");
String[] need = all[1].split("^");
show.setNextNr(need[0]);
show.setNextTitle(need[1]);
show.setNextDate(need[2]);
现在它只存储,整个字符串NextNr
04x22^Killing Your Number^May/15/2009
怎么了?