Alternative for String.join in Android?

前端 未结 3 482
伪装坚强ぢ
伪装坚强ぢ 2020-12-14 05:19

I want to concatenate an ArrayList with commas as separators. I found this answer, stating it\'s possible to use String.join in Java.

When I try to use

3条回答
  •  借酒劲吻你
    2020-12-14 06:03

    You can use TextUtils.join instead:

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

    (String.join was added in Java 8, which is why you can't use it in Android.)

提交回复
热议问题