Given NSString containing a letter like

  • I'm creating an index for a table that we're sorting. Sorting using localized compare will properly compare ç with c. But then my index shows both c and ç. Given that I'm simply taking the first character of the string, how can I get the letter "C" when the string starts with "Ç"?
  • On Jul 21, 2012, at 6:26 PM, Alex Kac <alex...> wrote:

    > I'm creating an index for a table that we're sorting. Sorting using localized compare will properly compare ç with c. But then my index shows both c and ç. Given that I'm simply taking the first character of the string, how can I get the letter "C" when the string starts with "Ç"?

    You will probably want to do your comparisons based on strings that you've folded via -stringByFoldingWithOptions:locale:, and i fyou fold with diacritic insensitivity then you should fold out the cedillas.
    --
    David Duncan
  • Yup. That's what I was looking for. The word "Folding" just didn't register with me as what I was looking for as I searched the docs. Thanks!

    On Jul 21, 2012, at 8:57 PM, David Duncan <david.duncan...> wrote:

    > On Jul 21, 2012, at 6:26 PM, Alex Kac <alex...> wrote:
    >
    >> I'm creating an index for a table that we're sorting. Sorting using localized compare will properly compare ç with c. But then my index shows both c and ç. Given that I'm simply taking the first character of the string, how can I get the letter "C" when the string starts with "Ç"?
    >
    >
    > You will probably want to do your comparisons based on strings that you've folded via -stringByFoldingWithOptions:locale:, and i fyou fold with diacritic insensitivity then you should fold out the cedillas.
    > --
    > David Duncan
    >

    Alex Kac - President and Founder
    Web Information Solutions, Inc.

    "Patience is the companion of wisdom."
    --Anonymous
previous month july 2012 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today