Help with Sorting Order, Please

Discussion in 'C++' started by D. Roshani, Jul 8, 2003.

  1. D. Roshani

    D. Roshani Guest

    Hello !

    I wonder if any one can help me to create a cosomize sorting order (as Macro or added small program
    in c++ or c# which does this work) in a Access Database contaning one table only words encoded in
    ISO-8859-1

    A a B b C c D d E e É é F f G g H h I i Í í J j
    1 2 3 4 5 6 7 8 9 10 11 12
    Jh jh K k L l ll M m N n O o P p Q q R r rr S s
    13 14 15 16 17 18 19 20 21 22 23 24
    Sh sh T t U u Ú ú Ù ù V v W w X x Y y Z z
    25 26 27 28 29 30 31 32 33 34

    There some unique cases in this alphabet that has to be considered while sorting.

    a. Letters with diacritical (é, í, ú, ù). The Unicode numbers for these letters are:

    I. Lower cases: (é – [U+00E9], [&#233]), (í – [U+00ED], [&#237]), (ú – [U+00DA], [&#250]), (ù –
    [U+00F9], [&#249])
    II. Upper cases: (É – [U+00C9], [&#201]), (Í – [U+00CD], [&#205]), (Ú – [U+00DA], [&#218]), (Ù –
    [U+00F9], [&#217])

    b. Combined letters which have to be treated as on single letter like (Jh initial case), (jh,
    non-initial case), (ll, only non-initial case), (rr, only non-initial case) (Sh initial case) and
    (sh, non-initial case),

    c. The positions of the letters are marked from 1 to 34 starts from top left to right. This will
    help to sort the words according to Kurdish Unified Alphabet. The sorting system needs to consider
    the rank of level of priority to place cases in a and b in correct alphabetic position.

    Thank you Dilan
     
    D. Roshani, Jul 8, 2003
    #1
    1. Advertising

  2. "D. Roshani" wrote:
    >
    > Hello !
    >
    > I wonder if any one can help me to create a cosomize sorting order (as Macro or added small program
    > in c++ or c# which does this work) in a Access Database contaning one table only words encoded in
    > ISO-8859-1


    [snip]

    And why do you think the C++ people can help.
    Your question is all about: How do I smuggle a custom comparison function into Access.
    So I would start by asking the Access people on how to do that. But that's a different
    newsgroup.

    --
    Karl Heinz Buchegger
     
    Karl Heinz Buchegger, Jul 8, 2003
    #2
    1. Advertising

  3. D. Roshani wrote:
    > Hello !
    >
    > I wonder if any one can help me to create a cosomize sorting order (as
    > Macro or added small program in c++ or c# which does this work) in a
    > Access Database contaning one table only words encoded in ISO-8859-1
    >
    > A a B b C c D d E e É é F f G g H h I i Í
    > í J j
    > 1 2 3 4 5 6 7 8 9 10 11 12
    > Jh jh K k L l ll M m N n O o P p Q q R r
    > rr S s
    > 13 14 15 16 17 18 19 20 21 22 23 24
    > Sh sh T t U u Ú ú Ù ù V v W w X x Y y Z z
    > 25 26 27 28 29 30 31 32 33 34


    Is this supposed to be a table? If you're going to do this, please do
    it in a monospaced font!

    > There some unique cases in this alphabet that has to be considered while
    > sorting.
    >
    > a. Letters with diacritical (é, í, ú, ù). The Unicode numbers for
    > these letters are:

    <snip>
    > b. Combined letters which have to be treated as on single letter like
    > (Jh initial case), (jh, non-initial case), (ll, only non-initial case),
    > (rr, only non-initial case) (Sh initial case) and (sh, non-initial case),


    Here's how I'd do it.

    Define a two-dimensional array of strings or a three-dimensional array
    of characters to hold the letters, something like this:

    char alphabet[34][2][3] = {
    {"A", "a"}, {"B", "b"},
    // ...
    {"Jh", "jh"}, {"K", "k"}, {"L", "l"},
    {"ll", "ll"}, // no initial case form, so repeat
    // lowercase form
    // ...

    };

    Now define a comparator function similar to strcmp. Starting with the
    beginning of both strings, scan your alphabet array from the end (so
    that the compound letters are caught) until you find the entry that your
    string begins with. If they differ, return the difference between the
    letter indexes. Otherwise, move straight onto the next letter and repeat.

    Now, depending on how the data you want to sort is stored, you could use
    qsort or write a function to do the sorting based on your comparator
    function.

    HTH

    Stewart.

    --
    My e-mail is valid but not my primary mailbox. Please keep replies on
    on the 'group where everyone may benefit.
     
    Stewart Gordon, Jul 8, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    552
    Chris Uppal
    May 5, 2005
  2. Soren Kuula
    Replies:
    2
    Views:
    529
    Soren Kuula
    Feb 1, 2004
  3. KK
    Replies:
    2
    Views:
    664
    Big Brian
    Oct 14, 2003
  4. MuZZy
    Replies:
    7
    Views:
    1,799
    Mike Hewson
    Jan 7, 2005
  5. cspoh
    Replies:
    0
    Views:
    264
    cspoh
    Jul 31, 2003
Loading...

Share This Page