Java Scanner Usage toWords(String content)

Here you can find the source of toWords(String content)

Description

to Words

License

Apache License

Declaration

public static ArrayList<String> toWords(String content) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static ArrayList<String> toWords(String content) {
        Scanner s = new Scanner(content);
        s.useDelimiter("\\s");

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

        while (s.hasNext()) {
            wordsArray.add(s.next().toLowerCase());
        }/*from   ww w .j  a  v  a2 s .  co  m*/

        s.close();

        return wordsArray;
    }
}

Related

  1. stringToDoubleList(String s)
  2. swapElements(int length, int maxValue)
  3. termInput()
  4. Tokenize(String s, String s2, String s3)
  5. toNumeric(String ip)
  6. transformTXTandANNtoRQS(String TXT, String ANN)
  7. trim(String s)
  8. validateInt(Scanner keyboard, String message, String error)
  9. waitForEnter()