I use standard approach to display my database records in the ListView:
recordsCursor = mDb.query(DATABASE_BL_TABLE, new String[] {KEY_BL_ROWID, KEY_BL_SENDER, KEY_BL_ADDED}, null, null, null, null, KEY_BL_SENDER);
startManagingCursor(recordsCursor);
String[] from = new String[]{DbAdapter.KEY_BL_SENDER};
int[] to = new int[]{R.id.text1};
adapter = new SimpleCursorAdapter(this, R.layout.mylist_row, recordsCursor, from, to);
setListAdapter(adapter);
So, all records are sorted by KEY_BL_SENDER
.
I would like to implement the following sorting logic:
- ignore case (so, the list of 4 elements -
aa
, bb
, AA
, BB
will be displayed in the following order: AA
, aa
, BB
, bb
);
- ignore other symbols besides letters (the list of 4 elements -
** aa **
, ~bb~
, aa
, __BB__
will be displayed in the following order: aa
, ** aa **
, __BB__
, ~bb~
).
How could I do it?