How to ignore uppercase and Lowercase in Firebase search
I have a method to return a Firebase user list as a result of a Firebase search SearchView
(onQueryTextChange()
).
However the method is case sensitive, I wanted to ignore this but so far I don't know how. For example, if you search for k
and K
, the results are different when they should be the same.
public void pesquisaUsuario(String texto){
listaUsuarios.clear();
if (texto.length() > 0 ){
Query query = usuariosF.orderByChild("nome")
.startAt(texto)
.endAt(texto + "\uf8ff");
query.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot ds : dataSnapshot.getChildren()){
listaUsuarios.add(ds.getValue(Usuario.class));
}
adapterPesquisa.notifyDataSetChanged();
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
}
1