1

I have a VisualForce page with an extension that returns data from a list. When the data is displayed on the page, it appears as:

[A, B, C, D, E, F]

Is there any way to get rid of the brackets on each side so that it appears as:

A, B, C, D, E, F

Here is the code for my extension constructor.

List<String> myList {get; set;}
public myExtension(ApexPages.StandardController con)
{
    this.myList = new List<String>{'A', 'B', 'C', 'D', 'E', 'F'};
}

So when I display it on my VisualForce page with {!myList}, the brackets show up. I still want them all on the same line separated by commas (not iterated through). Is there any way to do this? Thanks!

1 Answer 1

2

Easy peasy....

List<String> myList {get; set;}
public String myListString {get;set;};

public myExtension(ApexPages.StandardController con)
{
    this.myList = new List<String>{'A', 'B', 'C', 'D', 'E', 'F'};
    myListStirng = string.join(myList,',');
}

Then output myListString on the page

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .