日期:2014-05-20  浏览次数:20918 次

java新手请各位高手指教、、字符串的拆分问题。。
<vCard xmlns="vcard-temp"><FN/><type>asdasdasd</type><PHOTO><TYPE>image/jpg</TYPE><BINVAL>456.jpg</BINVAL</PHOTO></vCard> ,在这个字符串中,我要怎么样才能得到456.jpg,其他的都不要,,,有劳各位老手了、、

------解决方案--------------------
Java code


int index = str.indexOf("</BINVAL");    //如果格式不变的话..
str = str.substring(0, index);
index = str.lastIndexOf(">");
System.out.println(str.substring(index + 1, str.length()));