android1101 android1101 - 28 days ago 12
Android Question

Separate particular word from string

I have One String
which has value

String someString = "/category/subcategory/Fruit/apple/";


I want to separate "Fruit" from string.

Answer

Make an Array of Strings by splitting with / character like:

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

This Array split[] has all the elements separated. You can use whichever you want.

Comments