Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.StringTokenizer;

public class Main {
    public static ArrayList<String> splitInputStringIntoWords(String msg) {

        StringTokenizer token = new StringTokenizer(msg, " ");

        ArrayList<String> wordsList = new ArrayList<String>();

        String nextWord;
        while (token.hasMoreTokens()) {

            nextWord = token.nextToken();
            // Log.d(TAG, " inside getWords while loop.. nextToken - " +
            // nextWord);

            wordsList.add(nextWord);

        }

        return wordsList;
    }
}