cancel
Showing results for 
Search instead for 
Did you mean: 

Make Table filter case-insensitive

Former Member
0 Kudos

Hi,

I am using the TableFilter.java file to filter the enteries in the table. But the problem is, the results are case sensitive. So i tried adding the following lines of code

<b>if(o1 instanceOf String && o2 instanceOf String){

String s1 = o1.toString();

String s2 = o2.toString();

return s1.compareToIgnoreCase(s2);

}</b>

just before the return statement in

private static final Comparator DEFAULT = new Comparator()

But still the filter is case sensitive.

Can you help me make it case in sensitive

Regards,

Prathamesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Try with this

s1.toUpperCase().compareToIgnoreCase(s2.toUpperCase());

Regards

Abhijith YS

Former Member
0 Kudos

Hi Abhijit,

I have tried your piece of code but still the filter has not turned case insensitive.

Prathamesh

Answers (2)

Answers (2)

former_member485701
Active Participant
0 Kudos

Hi ,

in your compare program you can use:

string.equalsIgnoreCase(anotherString)

This will definitely work.

Feel free for any queries.

Regard,

Praveen

SRudra
Contributor
0 Kudos

Are you sure that all data is of type String ? Check that first.