Re: How to count composed characters in NSString?

2008-09-30 Thread David Niemeijer
Hi Peter, On Sep 30, 2008, at 7:58 AM, Peter Edberg wrote: CFStringGetRangeOfComposedCharactersAtIndex and -[NSString rangeOfComposedCharacterSequenceAtIndex:] are the modern replacements for UCFindTextBreak with kUCTextBreakClusterMask and indeed they now are closer to the original intent

Re: How to count composed characters in NSString?

2008-09-29 Thread Douglas Davidson
On Sep 28, 2008, at 11:17 AM, David Niemeijer wrote: I need to be able to display the number of characters to the user in a way that makes sense to them. If they see 3 I should report 3. I also need it to cut-off certain input to the number of real characters and should not generate

Re: How to count composed characters in NSString?

2008-09-29 Thread Michael Ash
On Mon, Sep 29, 2008 at 12:52 AM, Michael Gardner [EMAIL PROTECTED] wrote: But composed character sequences aren't the problem; surrogate pairs are. Composed character sequences can be taken care of by using either -precomposedStringWithCanonicalMapping or

Re: How to count composed characters in NSString?

2008-09-29 Thread David Niemeijer
Hi Douglas and Peter, On Sep 29, 2008, at 6:39 PM, Douglas Davidson wrote: On Sep 28, 2008, at 11:17 AM, David Niemeijer wrote: I need to be able to display the number of characters to the user in a way that makes sense to them. If they see 3 I should report 3. I also need it to cut-off

Re: How to count composed characters in NSString?

2008-09-29 Thread Peter Edberg
On Sep 29, 2008, at 9:27 PM, David Niemeijer wrote: Hi Douglas and Peter, On Sep 29, 2008, at 6:39 PM, Douglas Davidson wrote: On Sep 28, 2008, at 11:17 AM, David Niemeijer wrote: I need to be able to display the number of characters to the user in a way that makes sense to them. If they

Re: How to count composed characters in NSString?

2008-09-28 Thread Gerriet M. Denkmann
On Sun, 28 Sep 2008 03:27:48 -0500, Michael Gardner [EMAIL PROTECTED] wrote: On Sep 27, 2008, at 2:23 PM, David Niemeijer wrote: Hi, I have been trying to find this in the documentation and list archives but without success so far. What is the best way to count the number of characters in

Re: How to count composed characters in NSString?

2008-09-28 Thread Michael Gardner
On Sep 28, 2008, at 5:53 AM, Gerriet M. Denkmann wrote: On Sun, 28 Sep 2008 03:27:48 -0500, Michael Gardner [EMAIL PROTECTED] wrote: On Sep 27, 2008, at 2:23 PM, David Niemeijer wrote: Hi, I have been trying to find this in the documentation and list archives but without success so far.

Re: How to count composed characters in NSString?

2008-09-28 Thread Michael Ash
On Sat, Sep 27, 2008 at 3:23 PM, David Niemeijer [EMAIL PROTECTED] wrote: Hi, I have been trying to find this in the documentation and list archives but without success so far. What is the best way to count the number of characters in an NSString taking account of the fact that some

Re: How to count composed characters in NSString?

2008-09-28 Thread David Niemeijer
Michael, On 28 sep 2008, at 14:41, Michael Gardner wrote: Upon further investigation, I may be wrong. I based my assertion upon Apple's NSString documentation (Returns the number of Unicode characters in the receiver), and upon some quick tests I ran. But this reply made me look into the

Re: How to count composed characters in NSString?

2008-09-28 Thread Kyle Sluder
On Sun, Sep 28, 2008 at 2:17 PM, David Niemeijer [EMAIL PROTECTED] wrote: I need to be able to display the number of characters to the user in a way that makes sense to them. If they see 3 I should report 3. I also need it to cut-off certain input to the number of real characters and should not

Re: How to count composed characters in NSString?

2008-09-28 Thread Kirk Kerekes
strings to the user, do so in an NSTextView, and then query the NSLayoutManager associated with that view. On Sep 27, 2008, at 9:37 PM, [EMAIL PROTECTED] wrote: Message: 15 Date: Sat, 27 Sep 2008 21:23:25 +0200 From: David Niemeijer [EMAIL PROTECTED] Subject: How to count composed characters

Re: How to count composed characters in NSString?

2008-09-28 Thread Peter Edberg
On Sep 28, 2008, at 12:02 PM, [EMAIL PROTECTED] wrote: -- Message: 1 Date: Sun, 28 Sep 2008 20:17:26 +0200 From: David Niemeijer [EMAIL PROTECTED] Subject: Re: How to count composed characters in NSString? To: Cocoa-Dev List

Re: How to count composed characters in NSString?

2008-09-28 Thread Peter Edberg
On Sep 28, 2008, at 3:05 PM, Peter Edberg wrote: David, Check out CFStringGetRangeOfComposedCharactersAtIndex. It finds the kinds of text boundaries that I think you are interested in. You would just need to iterate over the string calling this for each iteration to find the next

Re: How to count composed characters in NSString?

2008-09-28 Thread Michael Gardner
On Sep 28, 2008, at 1:17 PM, David Niemeijer wrote: Michael, On 28 sep 2008, at 14:41, Michael Gardner wrote: Upon further investigation, I may be wrong. I based my assertion upon Apple's NSString documentation (Returns the number of Unicode characters in the receiver), and upon some quick

Re: How to count composed characters in NSString?

2008-09-28 Thread Clark S. Cox III
Sent from my iPhone On Sep 28, 2008, at 21:52, Michael Gardner [EMAIL PROTECTED] wrote: On Sep 28, 2008, at 1:17 PM, David Niemeijer wrote: Michael, On 28 sep 2008, at 14:41, Michael Gardner wrote: Upon further investigation, I may be wrong. I based my assertion upon Apple's NSString

How to count composed characters in NSString?

2008-09-27 Thread David Niemeijer
Hi, I have been trying to find this in the documentation and list archives but without success so far. What is the best way to count the number of characters in an NSString taking account of the fact that some characters may take up multiple 16 bit slots. Using - (NSUInteger)length is