> On Apr 2, 2015, at 4:54 AM, Charles Jenkins <[email protected]> wrote:
> 
> What would be nice is a way to count leading and trailing characters in place 
> while the thing is still an NSAttributedString--without using 
> NSAttributedString.string to convert to a Swift string in the first place. If 
> there were no conversion to the unicode-compliant and amazingly 
> difficult-to-do-anything-with-it Swift string, I’d be more confident that the 
> shrunken range I calculate would be apples to apples.

Use NSString.rangeOfCharactersFromSet() on the attributed string’s underlying 
NSString.

Don’t use any native Swift String character accessors, because the character 
positions aren’t going to agree with NSString since they use different 
interpretations of Unicode.

—Jens
_______________________________________________

Cocoa-dev mailing list ([email protected])

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

This email sent to [email protected]

Reply via email to