I am working on android application. I am getting the String value from webservice extension i want to split 4 from the string by using index .pls tell me how can do this
String version = "1.4.2";
I am working on android application. I am getting the String value from webservice extension i want to split 4 from the string by using index .pls tell me how can do this
String version = "1.4.2";
can you try this :
String[] items = "1.4.2".split("\\.");
String version = items[1].toString();
have all the sub-part of your string using
String[] strs = version.split("\.");
now if you want 4 from (1.4.2), do following:
String mMiddle = strs[1]; // it will give 4 as a string in mMiddle
if you want every sub-part:
String mStart = strs[0]; //returns 1
String mMiddle = strs[1]; //returns 4
String mLast = strs[2]; //returns 2