java - Add variable to ArrayList with custom split -


i'm trying add string arraylist<string> using .add(string). works, separates variables using comma (","). makes problematic me later on when try split string, because of sentences contain commas.

how change comma variable when adding string arraylist?

what doing using tostring method of arraylist print each of element of arraylist separated commas.

solution:

just iterate of arraylist , append them using string builder.

sample:

    arraylist<string>  s= new arraylist<>();     s.add("adsasd");     s.add("adsasd");     s.add("adsasd");     s.add("adsasd");     stringbuilder s2 = new stringbuilder();     for(string s3 : s)         s2.append(s3+" ");     system.out.println(s2); 

result:

adsasd adsasd adsasd adsasd  

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -