It is necessary to get a list of words from one column, in which there will be English and Russian words in alphabetical order. Also if it is impossible or difficult task. How to sort the already received list in the same way? It would be necessary first to have Russian words in alphabetical order, after English words in alphabetical order.
1 answer
String rule = "&А,а<Б,б<В,в<Г,г<Д,д<Е,е<Ё,ё<Ж,ж<З,з<И,и<Й,й<К,к<Л,л<М,м<Н,н" + "<О,о<П,п<Р,р<С,с<Т,т<У,у<Ф,ф<Х,х<Ц,ц<Ч,ч<Ш,ш<Щ,щ<Ъ,ъЫ,Ы,Ь,ь<Э,э<Ю,ю<Я,я" + "<A,a<B,b<C,c<D,d<E,e<F,f<G,g<H,h<I,i<J,j<K,k<L,l<M,m<N,n<O,o<P,p<Q,q" + "<R,r<S,s<T,t<U,u<V,v<W,w<X,x<Y,y<Z,z<0<1<2<3<4<5<6<7<8<9" + "<'!'<'@'<'#'<'$'<'%'<'^'<'&'<'*'<'('<')'<'_'<'+'<'±'<'§'<'<'<'>'<'/'<'?'<'.'<','<'\"'<';'<':'<'\\'<'|'<'`'<'~'<'['<']'<'{'<'}'" This rule is for the java.text.RuleBasedCollator java.text.RuleBasedCollator
From the database it is not possible to sort as you want, sort with a colator
- I already wanted to write a version with a comparator, he knocks me first English and then Russian. I decided to make the definition of the first letter and in case of English, then return -1. I think correctly? - Flippy
- so the colator can be used inside the comparator. Defining a letter will work crookedly. Collator is a cleaner and less complicated decision, and the most important is the right one. - andreich
|
Cursor cursor = database.query("имя таблицы", null, null, null, null, null, "имя столбца");I get a list in which first English words, after Russian. And I need Russian words to be originally, after English words - Bosya Anton