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 thus not the right way. Using a series of calls to "rangeOfComposedCharacterSequenceAtIndex:" seems like a possibility, but I am not sure this would be the most efficient way. Is there a simple and straightforward solution? I would like to be able to display the number of characters in a string and not report the wrong results for foreign languages (which I would get if I simply took the length of the string). I need a solution that does not only work in Leopard (i.e. CFStringTokenizer is not an option) and that does not require using the lower level UCFindTextBreak.

Thanks,

david.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to