Here you can find the source of splitElements(String values)
Parameter | Description |
---|---|
values | The values list as a single string. |
public static List<String> splitElements(String values)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static final String DEFAULT_VALUE_SEPARATOR = "~"; /**/* ww w . j av a 2 s. com*/ * Split a list of values. * * @param values * The values list as a single string. * @return The values. */ public static List<String> splitElements(String values) { final ArrayList<String> list = new ArrayList<String>(); try { if (values != null) { final String[] split = values.trim().split(DEFAULT_VALUE_SEPARATOR); if (split != null && split.length != 0) { for (final String value : split) { if (value != null) { list.add(String.valueOf(value)); } } } } } catch (ClassCastException e) { // digest exception. } return list; } }