Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get some particular word from String in JAVA Android?

I have one String

String path = /PravinSB/servlet/com.gjgj.rmf.controllers.Hello

from this String I need only word - PravinSB.

How can I do this in JAVA

like image 270
Pravin Mohol Avatar asked Apr 22 '26 06:04

Pravin Mohol


2 Answers

Try this

String path = /PravinSB/servlet/com.gjgj.rmf.controllers.Hello

String[] split = path.split("/");

String name = split[1]; //name is your result.
like image 95
Sanket Shah Avatar answered Apr 24 '26 18:04

Sanket Shah


String path = /PravinSB/servlet/com.gjgj.rmf.controllers.Hello
String[] split = path.split("/");
String name = split[1]; //name is your result.

check below link

http://ideone.com/4Uzosq

like image 39
Deepak Avatar answered Apr 24 '26 18:04

Deepak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!