Re: characterAtIndex: method and composite characters
Re: characterAtIndex: method and composite characters
- Subject: Re: characterAtIndex: method and composite characters
- From: Greg Titus <email@hidden>
- Date: Wed, 4 Apr 2007 08:12:25 -0700
On Apr 4, 2007, at 8:05 AM, Ewan Delanoy wrote:
-when an NSString or
NSAttributedString (let's call it s) appears on-screen as, say, "(a
with
tilda)(other characters ...)" is
it guaranteed that [s characterAtIndex: 0] will be "a with tilda",
and
not "a" (with "tilda" for a second
character) ?
-If this is not the case, I need a more accurate version of
"characterAtIndex:". Is this already
built-in ?
You want the -precomposedStringWithCanonicalMapping, and -
decomposedStringWithCanonicalMapping methods. Depending upon what you
mean by "more accurate" (one isn't really any more accurate than the
other), you take your original string (which might be either way) and
call the precomposed method to get a new string which is guaranteed
to be in the "a with tilde" form, or the decomposed method to get a
new string which is guaranteed to be in the "a with tilde for second
character" form.
Hope this helps,
- Greg
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden