Java String to List stringToList(String str)

Here you can find the source of stringToList(String str)

Description

string To List

License

Open Source License

Declaration

protected static List<String> stringToList(String str) 

Method Source Code


//package com.java2s;
import java.util.ArrayList;

import java.util.List;

public class Main {
    protected static List<String> stringToList(String str) {
        List<String> list = new ArrayList<>();
        if (str != null) {
            String tmp = str.replace('&', ',');
            String[] pieces = tmp.split(",");
            for (String piece : pieces) {
                String target = piece.trim();

                if (target.length() > 0) {
                    list.add(target);/* w w w . ja  va  2 s  .  c om*/
                }
            }
        }
        return list;
    }
}

Related

  1. stringToList(String s)
  2. stringToList(String s)
  3. stringToList(String source)
  4. stringToList(String sText)
  5. stringToList(String str)
  6. stringToList(String str, char delimiter)
  7. stringToList(String str, String delim)
  8. stringToList(String string, String separator)
  9. stringToList(String text, String seperator)