I have a set of strings which want to combine into one String with all sentences separated with coma like (*.csv)
here is how it goes with me:
String dataContainer;
for(String tempString:setInput){
     String finalString = "," + tempString + "," ;   
}
This doesn't work with me :(
But it should do for Set ex:
Set<String> setInput = new TreeSet();
setInput.add("Dog");
setInput.add("Cat");
setInput.add("Mouse");
to produce the string:
,Dog,,Cat,,Mouse,
                It is better to use StringBuilder 
 StringBuilder sb= new StringBuilder();
for(String tempString:setInput){
   sb.append(",").append(tempString).append(",");   
 }
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With