0

I'm using a SearchManager in my app to search for words in SQLite database. It works fine, but I would like to search for letters in a word. For example, if you search for cpur it would show the words that cointain those letters (computer). Is there a way to customize the search manager to work like that?

fanboy555
  • 291
  • 2
  • 7
  • 20

2 Answers2

0

Would be easier to answer this if you had given more informations, but lets assume you select words like this:

select words from text where word='target'

you can get words that looks like it as well this way:

select word from text where word like '%target%';

meaning that on either side of target, there can be any number of characters from the string. Hope this helps and is what you needed.

Anders Metnik
  • 6,096
  • 7
  • 40
  • 79
  • I'm using the Android sample project SearchableDictionary http://www.java2s.com/Code/Android/Database/SearchableDictionary.htm – fanboy555 Jan 24 '13 at 12:50
0

or, if You don´t want to use sqlite commands, this should work also after You have get the String from Your table:

       boolean contains = false;

      if(YourWord.contains(YourNeededString)){
               contains =   true;
     else{
               contains =   false;
          }
Opiatefuchs
  • 9,800
  • 2
  • 36
  • 49