Hello All,
I am using a stringtokenizer to divide a string while comparing each word in the string to a specific word and pushing it onto a stack. I can push it onto the stack with no problems; however, I cannot get it to find the specific word.
for Example:
String a = "I am here and there I go."
I need to find the word "there" in order to proceed with the rest of my program.
Here is a snippet of my code:
StringTokenizer temp = new StringTokenizer(a);
while(temp.hasMoreTokens())
{
if(!temp.nextElement().equals("there"))
stack.push(temp.nextElement());
}
Any assistance will be appreciated.