Results 1 to 3 of 3
Thread: question on string tokenizer
- 05-23-2008, 04:11 AM #1
Member
- Join Date
- May 2008
- Posts
- 7
- Rep Power
- 0
question on string tokenizer
when i split a string into tokens and comparing with another string its giving me false can any body help me out
String str="hello this is pardhu:at hyderabad;";
if i split it and compars as
StringTokenizer st=new StringTokenizer(str,":;");
while(st.hasMoreTokens())
{
if(st.hasMoreTokens.equalsIgnoreCase("hellothis is pardhu"))
{
......
......
}
}
it is returining false can some body help me out
- 05-23-2008, 04:35 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
You don't have deal with the next token here. Simply you don't start to find the first token either.
- 05-23-2008, 05:00 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Keep in mind that, equalsIgnoreCase() not support for the patterns. I mean strings you comparing are not in same length. Because you have remove a white space in the second string.
Similar Threads
-
Question mark colon operator question
By orchid in forum Advanced JavaReplies: 9Last Post: 12-19-2010, 08:49 AM -
Error: cannot resolve symbol' on Person (java.lang.String, java.lang.String)
By baltimore in forum New To JavaReplies: 2Last Post: 09-18-2008, 07:30 AM -
Using java.util.Scanner to search for a String in a String
By Java Tip in forum Java TipReplies: 0Last Post: 11-20-2007, 04:59 PM -
Help with insertName(String name) and deleteName(String name)
By trill in forum New To JavaReplies: 1Last Post: 08-07-2007, 07:29 AM -
I can't seem to pass the value of a string variable into a string array
By mathias in forum Java AppletsReplies: 1Last Post: 08-03-2007, 10:52 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks