Concatenating elements in an array to a string

前端 未结 19 2337
慢半拍i
慢半拍i 2020-12-08 02:43

I\'m confused a bit. I couldn\'t find the answer anywhere ;(

I\'ve got an String array:

String[] arr = [\"1\", \"2\", \"3\"];

then

19条回答
  •  误落风尘
    2020-12-08 03:15

    For those who develop in Android, use TextUtils.

    String items = TextUtils.join("", arr);
    

    Assuming arr is of type String[] arr= {"1","2","3"};

    The output would be 123

提交回复
热议问题