Вопрос

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