• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unicode case conversion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unicode case conversion


  • Subject: Re: Unicode case conversion
  • From: Frederick Cheung <email@hidden>
  • Date: Thu, 25 Nov 2004 08:41:59 +0000


On 25 Nov 2004, at 02:04, Robbie Haertel wrote:

I'm not very knowledgeable about the unichar type.  I need to compare
characters one-by-one so I use the characterAtIndex: from NSString to
get the character and use '==' et al to do the comparison.
You should be aware that it is possible to represent a given glyph in multiple ways in unicode so your method may produce funny things.
It is also the case that a character in your string doesn't actually correspond to a glyph.
For example capital E with an acute accent can be represented as 00C9 or as plain E 0045 followed by 0301 (combining acute accent).
Then of course you have got surrogate pairs and what not. In general comparing unicode strings is a very non-trivial thing. I would use the methods the system gives you.


I believe you can use rangeOfComposedCharacterSequenceAtIndex: to split the string into graphaemes
However,
in some cases I need to change the unichar to lower and compare them.
What function will do this?  I can't just convert the NSString to
lowercase a priori because I need to maintain the case information in
most cases.  I'm sure there is a simple lower() function that takes a
unichar argument.


lowercasing can also be rather tricky. NSString has caseInsensitiveCompare:


Fred

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Unicode case conversion (From: Robbie Haertel <email@hidden>)

  • Prev by Date: Re: Performance with keyed archives
  • Next by Date: What's wrong with this code?
  • Previous by thread: Re: Unicode case conversion
  • Next by thread: Using AEBuild commands to send IM to iChat and AIM
  • Index(es):
    • Date
    • Thread