Java String to List stringToList(String s)

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

Description

string To List

License

Mozilla Public License

Declaration

private static ArrayList<String> stringToList(String s) 

Method Source Code

//package com.java2s;
/*/*w ww . ja  va  2  s . com*/
 The contents of this file are subject to the Mozilla Public License Version 
 1.1 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at http://www.mozilla.org/MPL.
    
 The Original Code is the DoPE Pharmacoepidemiology Toolbox.
    
 The Initial Developer of the Original Code is the Brigham and Women's Hospital 
 Division of Pharmacoepidemiology.
    
 Contributor(s):
 Jeremy A. Rassen <jrassen@post.harvard.edu>
 */

import java.util.ArrayList;

public class Main {
    private static ArrayList<String> stringToList(String s) {
        ArrayList<String> l = new ArrayList<String>();

        if ((s != null) && (s.length() > 0)) {
            String[] stringTokens = s.split("\\s");
            for (int i = 0; i < stringTokens.length; i++)
                l.add(stringTokens[i].toUpperCase());
        }

        return l;
    }
}

Related

  1. stringToList(String keywords, String delimiter)
  2. stringToList(String listString, String delimiter)
  3. stringToList(String listText)
  4. StringToList(String listText, String regex)
  5. stringToList(String s)
  6. stringToList(String s)
  7. stringToList(String source)
  8. stringToList(String sText)
  9. stringToList(String str)