Join a string using delimiters

后端 未结 24 1608
北海茫月
北海茫月 2020-12-05 09:57

What is the best way to join a list of strings into a combined delimited string. I\'m mainly concerned about when to stop adding the delimiter. I\'ll use C# for my example

24条回答
  •  Happy的楠姐
    2020-12-05 10:35

    For java a very complete answer has been given in this question or this question.

    That is use StringUtils.join in Apache Commons

    String result = StringUtils.join(list, ", ");
    

提交回复
热议问题