About us

Join us FREE!

How to add double quotes automatically, converting list of strings as comma separated value?

Tutorial by Er Satya connectclue-author-image

All > Tech Blogger | Java | Spring Boot | HTML | CSS | MySQL > Java | Spring Boot

1 like

Please login to like this article.

connectclue-linkedin-share

How to add double quotes automatically, converting a list of strings as comma-separated values?


We can perform it in two steps with StringUtils only,
List s = new ArrayList<>();
s.add("ten");
s.add("twenty");
s.add("thirty");

String step1 = StringUtils.join(s, "\", \"");// Join with ", "
String step2 = StringUtils.wrap(step1, "\"");// Wrap step1 with "

System.out.println(step2);
Output,
"ten", "twenty", "thirty"


connectclue-linkedin-share

More articles:


Recent lost & found:


Login for enhanced experience

connectclue-tick Create and manage your profile

connectclue-tick Refer an author and get bonus Learn more

connectclue-tick Publish any lost and found belongings

connectclue-tick Connect with the authors & add your review comments

connectclue-tick Join us for Free to advertise for your business or Contact-us for more details

connectclue-tick Join us for Free to publish your own blogs, articles or tutorials and get your Benefits

connectclue-login

Back to top