Java - Append quotes to strings in an array and join strings in an array

前端 未结 7 740
后悔当初
后悔当初 2020-12-13 00:04

I would like to append double quotes to strings in an array and then later join them as a single string (retaining the quotes). Is there any String library which does this?

7条回答
  •  鱼传尺愫
    2020-12-13 00:24

    You can create the code for this functionality yourself as well:

    String output = "";
    
    for (int i = 0; i < listOfStrings.length; i++)
    {
        listOfStrings[i] = "\"" + listOfStrings[i] + "\"";
        output += listOfStrings[i] + ", ";
    }
    

提交回复
热议问题