문제

I have URL

../p/xmlProj/bugs/...

I'm looking for a way to extract the project name into single variable using java code I tried this

String url = "/p/xmlProject/bugs/";
final String[] projName = url.split("/",3);

But i didn't work for me !!

도움이 되었습니까?

해결책

You don't need this 3 there. Simply write:

final String[] projName = url.split("/");

And the project name will be projName[3].

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top