How to get data from array to string JAVA? -
i have array looks this:
ss="date:03/27/2017,text=sample,date:03/28/2017"
but want 03/27/2017
array 1 string how possible in java?
you use split method, take look:
string ss="date:03/27/2017,text=sample,date:03/28/2017"; string date = ss.split(",")[2].split(":")[1]; system.out.println(date);//03/28/2017
step-by-step
ss.split(",");//[date:03/27/2017, text=sample, date:03/28/2017] ss.split(",")[2];//date:03/28/2017 ss.split(",")[2].split(":");//[date, 03/28/2017] ss.split(",")[2].split(":")[1];//03/28/2017
Comments
Post a Comment