Hi,
I want to sort Special Characters,Digits, Latin and Greek
Characters(language independent sorting order) using ICU collation.
The sorting order shall be approached by separating the character set into
three groups:
a. special characters (i.e. +, -, &, Space, etc.)
b. digits (0-9)
c. Latin/Greek letters.
The digits shall be sorted below the special characters and the letters
shall be sorted below the digits.
Now i first try to sort special characters & digits according to requirement
& make customize collation rule like :
const static char* rule = "&SP < '\\u0021' < '\\u0022' < '\\u0023' <
'\\u0025' < '\\u0026' < '\\u0027' < '\\u0028'"
"< '\\u0029'"
" < '\\u002A' < '\\u002B' < '\\u002C' < '\\u002D' < '\\u002E' < '\\u002F' <
'\\u003A' < '\\u003B'"
" < '\\u003C' < '\\u003D' < '\\u003E' < '\\u003F' < '\\u0040' < '\\u005B' <
'\\u005C' < '\\u005D'"
" < '\\u005E' < '\\u005F' < '\\u0060' < '\\u007B' < '\\u007C' < '\\u007D' <
'\\u007E' < '\\u007F'"
" < '\\u00A1' < '\\u00A7' < '\\u00BF' < '\\u0024' < '\\u00A0' < '\\u00A2' <
'\\u00A3'"
" < '\\u00A4' < '\\u00A5' < '\\u20AC' < '\\u00A6' < '\\u00A8' < '\\u00A9' <
'\\u00AA' < '\\u00AB'"
" < '\\u00AC' < '\\u00AD' < '\\u00AE' < '\\u00AF' < '\\u00BO' < '\\u00B1' <
'\\u00B2' < '\\u00B3'"
" < '\\u00B4' < '\\u00B5' < '\\u00B6' < '\\u00B7' < '\\u00B8' < '\\u00B9' <
'\\u00BA' < '\\u00BB'"
" < '\\u00BC' < '\\u00BD' < '\\u00BE' < '\\u00D7' < '\\u00F7' < '\\u0030' <
'\\u0031' < '\\u0032'"
" < '\\u0033' < '\\u0034' < '\\u0035' < '\\u0036' < '\\u0037' < '\\u0038' <
'\\u0039'";
Use following function for rule :
rlen = u_unescape(rule, rlz, RULE_BUFFER_LEN);
coll = ucol_openRules(rlz, rlen, UCOL_DEFAULT, UCOL_DEFAULT,NULL,
&status);
Now when i give source = "xyz%" & target = "xyz*"
Using above customize collation rule ,result show that source is GREATER
than target , but desirable result require is source LESS than target.
Now i change the customize collation rule to :
const static char* rule = "&SP < '\\u0021' < '\\u0025' < '\\u0026' <
'\\u002A'";
Now using same source = "xyz%" & target = "xyz*" , i get source is LESS
than target , which is require result.
Can you please help me know what is wrong in first customize collation rule
?
Thanks in Advance.
With Regards
Ashish
"Be a Part of Solution"
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users