i want to have a case insensative search...can anyone help me out..... this is the code wich find only the word entered..(all caps or small or finds the word as present there) private void doFind() { String temp4 = ""; temp4 = ivjTextField1.getText(); String s3 = ivjTextArea1.getText(); int total = s3.length();
To make your search "case insensitive", you could convert both the search string and the text you are searching to all upper or lower case and then compare them. For example:
would yield a new string with value: "thisisastring"
Matt Senecal
Ranch Hand
Joined: Dec 01, 2000
Posts: 255
posted
0
Why not just use String.equalsIgnoreCase(String)?
Originally posted by john klucas: i want to have a case insensative search...can anyone help me out..... this is the code wich find only the word entered..(all caps or small or finds the word as present there) private void doFind() { String temp4 = ""; temp4 = ivjTextField1.getText(); String s3 = ivjTextArea1.getText(); int total = s3.length();
There's nothing more dangerous than a resourceful idiot. ---Dilbert
john klucas
Greenhorn
Joined: Jul 31, 2001
Posts: 23
posted
0
If u have lok at the code, i am not comparing two strings. I have a text area where i am displaying the o/p. so when the user wants to find anything..he just inputs that word... and my serach function finds the index of that word and matches that in the text area. its working fine if the users tries to find for a word which is exactly the same as it is present in the text area. So how can u do that??
Paul Stevens
Ranch Hand
Joined: May 17, 2001
Posts: 2823
posted
0
String temp4 = ""; temp4 = ivjTextField1.getText(); String s3 = ivjTextArea1.getText(); int total = s3.length();
Explain how that is not comparing 2 strings. You do a getText() from 2 different components returning Strings. Like a previous poster said convert them to all upper or lower then do your search. temp4 = ivjTextField1.getText().toUpperCase(); String s3 = ivjTextArea1.getText().toUpperCase();
john klucas
Greenhorn
Joined: Jul 31, 2001
Posts: 23
posted
0
thanx
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.