java - Android String to ArrayList - Comma Issue -


i'm trying convert string arraylist issue in case different saw.

my string this:

string data = [0|john|9999999999|no.54, street|new york, 1|bash|9898989898|no.5, road 2|city 2]

seperated:

0|john|9999999999|no.54, street|new york

1|bash|9898989898|no.5, road 2|city 2

here in 1st position it's id, name, next contact number, next address, @ last city...

data.split not work here due "," in address field..

is there way convert string arraylist or suggestions using different method?

regards,

lokesh

edit: might have field called comments might have pipe inside that:

example:

0|name|number|address|city|i might join|tomorrow

here "i might join|tomorrow" single sentence.

edit 2: found solution..

i replaced , , pipe in list *** , ***** (stars) server side...

thanks suggestions... :-)

the other answers did not escape pipe symbol |. wont work. working example:

string s = "0|john|9999999999|no.54, street|new york"; string[] array = s.split("\\|"); for(string word : array) system.out.println(word); 

outcome:

0
john
9999999999
no.54, street
new york

see here


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

android - Pass an Serializable object in AIDL -