I am having a list of String letterString
List<String> letterString = ['Jan', 'Feb', 'Mar'];
Below is teh output I want :
String outputString = 'Jan,Feb,Mar';
This is what I have done :
String outputString = '';
for(String s : letterString) {
outputString += s+',';
}
But outputString is Jan,Feb,Mar,
with an extra ,
at an end of string.
for loop
.I was not aware of ` string.Join()`. But if it can be done by using 1 line of code, why to go 5 lines of code. :) – SFDC Geek Dec 21 '14 at 16:20