Results 1 to 7 of 7
Thread: String Comparision
- 05-17-2011, 03:05 AM #1
Member
- Join Date
- May 2011
- Posts
- 8
- Rep Power
- 0
- 05-17-2011, 03:11 AM #2
Go to the Java API and read about the methods the String class has. One or more of them can help.
- 05-17-2011, 04:22 AM #3
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 11
What have you tried so far?
- 05-18-2011, 11:04 AM #4
Member
- Join Date
- May 2011
- Posts
- 3
- Rep Power
- 0
try something like this:
Java Code:String b = "my house is near the school"; //String b = "my house is near the"; // String b = "school is near the house"; String c = "school"; boolean match=false; for(int i=0;i<b.length()-c.length()+1;i++) { if(c.regionMatches(true,0,b,i,c.length())) { match=true; break; } } if(match) System.out.print(b);
- 05-18-2011, 11:28 AM #5
- 05-19-2011, 02:43 PM #6
Member
- Join Date
- May 2011
- Posts
- 3
- Rep Power
- 0
- 05-19-2011, 03:27 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
Similar Threads
-
Binary-algorithm -> Insert String to sorted String-ArrayList
By Muskar in forum Advanced JavaReplies: 12Last Post: 11-26-2010, 09:33 AM -
Test for all empty Strings in LinkedHashMap<String,ArrayList<String>
By albertkao in forum New To JavaReplies: 1Last Post: 11-04-2010, 07:53 PM -
Secret of String references comparision.
By Anjaneyulu in forum Advanced JavaReplies: 15Last Post: 02-24-2010, 03:32 PM -
String comparision method problem
By rons_sacramental in forum New To JavaReplies: 7Last Post: 10-15-2009, 06:15 AM -
comparision between two lists
By suprabha in forum Advanced JavaReplies: 14Last Post: 08-01-2008, 03:49 PM
Bookmarks