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"
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();
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??
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();