Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Case Insensative search  RSS feed

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i hope some one will help me out here.
i have a piece of code which basically searches whatever the user wants to search for. I have a TextArea which displays the o/p and a text field where users inputs whatever he wants to search for within that text area. But right now i am able to search only for one particular word. If user inputs a new word in place of the previous word it doesn't find that word or even if it finds it start searching from the index of the last word searched. i want the search function, to start searching for a word again from the start index.
Also how can i have case insensative search?
here is my code.
private void doFind()
{
String temp4 = "";
temp4 = ivjTextField1.getText();
String s3 = ivjTextArea1.getText();
int total = s3.length();
if(isfound ==false)
{
int ix = s3.indexOf(temp4);
if(ix >= 0)
{
lastindex = ix+temp4.length();
ivjTextArea1.select(ix, lastindex);
isfound = true;
}
}
else
{
int ix2 = s3.indexOf(temp4, lastindex+1);
if(ix2>=0)
{
lastindex = ix2+temp4.length();
ivjTextArea1.select(ix2, lastindex);
}
temp4 = null;
}
}
can any one help me out. Thanks in advance!
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try using the "equalsIgnoreCase(String anotherString) " method of String. or possibly converting both strings to lowercase.
will have to think about you other probs.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!