0

My arraylist contains the following details arraylist.get(0) will be like "name,age,place,address,city" Likewise I have many entries in the arraylist.

Expected output: table Name Age Place Address City

deepanmurugan
  • 1,815
  • 12
  • 18
  • Do you mean this: https://stackoverflow.com/questions/7488643/how-to-convert-comma-separated-string-to-arraylist ?? – it4Astuces Jan 20 '19 at 17:12

1 Answers1

0

You can write something like this to split it with the comma and then join it with the spaces using StringUtils,

import com.sun.deploy.util.StringUtils;
import java.util.Arrays;

public class Main {

    public static void main(String args[]) {
        String value = "name,age,place,address,city";
        String result = StringUtils.join(Arrays.asList(value.split(",")), " ");
        System.out.println(result);
    }
}
Sandeepa
  • 3,457
  • 5
  • 25
  • 41