关于JAVA截取字符串
举了例子吧,有这样几个字符串:
String str1 = "dsaf3d&channelid=34567&dsfghh3 ";
String str2 = "channelid=87654&sdf452 ";
String str3 = "channelid=76543&channelid=76543 ";
channelid=的数字都是五位.
现在我想有这样一种方法,可以取得channelid=后面的那五位数字.
还望大家指教
------解决方案--------------------错了耶,应该是这样的
String str2 = "channelid=87654&sdf452 ";
int index = str2.indexOf( "channelid ")+ "channelid ".length()+1;
String strFFF =str2.substring(index,index+5);