java - Split a string into two based on some special characters in android -


i have string this:

[{\"id\":2,\"text\":\"capital good\"},{\"id\":3,\"text\":\"general office items\"},{\"id\":1,\"text\":\"raw material purchase\"}]&@[{\"id\":2,\"text\":\"capital good\"},{\"id\":3,\"text\":\"general office items\"},{\"id\":1,\"text\":\"raw material purchase\"},{\"id\":0,\"text\":\"approved\"},{\"id\":1,\"text\":\"freezed\"},{\"id\":2,\"text\":\"cancelled\"},{\"id\":3,\"text\":\"completed\"},{\"id\":4,\"text\":\"foreclosed\"},{\"id\":5,\"text\":\"unapproved\"}] 

i want split string 2 based on &@ character combination this:

 string [] separated=line.split("&@"); 

but when checked values separated[0] contains perfect first half of string when checked separated[1] contains full string without "&@" characters. wanto separated[1] contain characters after "&@". appreciated.

[{\"id\":2,\"text\":\"capital good\"},{\"id\":3,\"text\":\"general office items\"},{\"id\":1,\"text\":\"raw material purchase\"}]  //&@  [{\"id\":2,\"text\":\"capital good\"},{\"id\":3,\"text\":\"general office items\"},{\"id\":1,\"text\":\"raw material purchase\"},{\"id\":0,\"text\":\"approved\"},{\"id\":1,\"text\":\"freezed\"},{\"id\":2,\"text\":\"cancelled\"},{\"id\":3,\"text\":\"completed\"},{\"id\":4,\"text\":\"foreclosed\"},{\"id\":5,\"text\":\"unapproved\"}] 

that's original string line break around &@ make clear splits. can see 2nd string starts repeated 1st string (without closing ]). split works fine.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -