StringTokenizer st = new StringTokenizer(line);
while (st.hasMoreTokens())
{
String wordIn = st.nextToken();
if (wordIn.endsWith("."))
wordIn = wordIn.replace('.', ' ').trim();
if (wordIn.endsWith("?"))
wordIn = wordIn.replace('?', ' ').trim();
if (wordIn.endsWith(","))
wordIn = wordIn.replace(',', ' ').trim();
String result = bd.searchBase(bd.getWords(), wordIn, 0, bd.getWords().length -1);
if (result != null)
System.out.println("Word found \n");
else
System.out.println(baseSuggestions(wordIn));
System.out.println("Press <Enter> for next word");
key.nextLine();
}
in the above code, a stream of words are extracted by the stringtokenizer separated by empty space, but when the word has the following characters (". , ?"), i want to convert the next word to lowercase, how do i go about that?
Thanks.