Here you can find the source of isToken(String sentence, String searchWord)
public static boolean isToken(String sentence, String searchWord)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static boolean isToken(String sentence, String searchWord) { StringTokenizer sentenceToken = new StringTokenizer(sentence, " .;:"); while (sentenceToken.hasMoreTokens()) { if (sentenceToken.nextToken().equals(searchWord)) return true; }//ww w . ja va 2 s. co m return false; } }