本文介绍了我该如何分割URL链接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何分割的URL链接字符串
StringTokenizer的ST =新的StringTokenizer(linkHref,.ashx的?作业ID =);;
字符串社区= st.nextToken(); 的System.out.println(社区);
以下
网址链接
<一个href=\"http://example.com/GetJob.ashx?JobID=19358502&JobTitle=Factory%20Workers%20in%20Oldham%20-%20Immediate%20Start%20Now&rad=20&rad_units=miles&pp=25&sort=rv.dt.di&vw=b&re=134&setype=2&tjt=factory&where=oldham&pg=1&avsdm=2015-09-10T05%3a54%3a00-05%3a00\" rel=\"nofollow\">http://example.com/GetJob.ashx?JobID=19358502&JobTitle=Factory%20Workers%20in%20Oldham%20-%20Immediate%20Start%20Now&rad=20&rad_units=miles&pp=25&sort=rv.dt.di&vw=b&re=134&setype=2&tjt=factory&where=oldham&pg=1&avsdm=2015-09-10T05%3a54%3a00-05%3a00
解决方案
的String = \"http://example.com/GetJob.ashx?JobID=19358502&JobTitle=Factory%20Workers%20in%20Oldham%20-%20Immediate%20Start%20Now&rad=20&rad_units=miles&pp=25&sort=rv.dt.di&vw=b&re=134&setype=2&tjt=factory&where=oldham&pg=1&avsdm=2015-09-10T05%3a54%3a00-05%3a00\"; S = s.substring(s.indexOf(作业ID =)+ 6);
S = s.substring(0,s.indexOf(与&amp; JOBTITLE));
的System.out.println(多个);
how do i split the string on url link
StringTokenizer st = new StringTokenizer(linkHref, ".ashx?JobID=");;
String community = st.nextToken();
System.out.println(community );
url link below
解决方案
String s = "http://example.com/GetJob.ashx?JobID=19358502&JobTitle=Factory%20Workers%20in%20Oldham%20-%20Immediate%20Start%20Now&rad=20&rad_units=miles&pp=25&sort=rv.dt.di&vw=b&re=134&setype=2&tjt=factory&where=oldham&pg=1&avsdm=2015-09-10T05%3a54%3a00-05%3a00";
s = s.substring(s.indexOf("JobID=") + 6);
s = s.substring(0, s.indexOf("&JobTitle"));
System.out.println(s);
这篇关于我该如何分割URL链接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!