Sir under CRX-Tries (Part3 ) How can i perform case insensitive search?

Sir under CRX-Tries (Part3 ) How can i perform case insensitive search?

You’ll have to check everytime if the character is lower case, then check for its uppercase too by reducing the ascii code and vice versa for upper case characters. A little addition in the same code

1 Like

I was thinking of a complex logic earlier :frowning: Got it now , Thanks Sir. Did something like this below and it worked!
char cc = word.charAt(0);
char ucc = Character.toUpperCase(cc);
char lcc = Character.toLowerCase(cc);
String ros = word.substring(1);
Node child = parent.children.get(lcc);
if ( child==null ){
child = parent.children.get(ucc);
if(child==null){
return false;
}

    }

Good job!
Also, another approach could be turning all the input text in either all lower case or all upper case at the starting and the search code remains same.
Well done :smiley:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.