android1101 android1101 - 7 months ago 44
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.


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.