On Apr 2, 2015, at 19:28 , Charles Jenkins <cejw...@gmail.com> wrote:
> 
> I can indeed call attrStr.string.rangeOfCharacterFromSet(). But in typical 
> Swift string fashion, the return type is as unfriendly as possible: 
> Range<String.Index>? — as if the NSString were a Swift string.

I finally read the whole of what you said here, and I had to run to a 
playground to check:

> import Cocoa
> 
> var strA = "Hello?, String”
> var strB = "Hello?, String" as NSString
> var strC = "Hello\u{1f650}, String”
> var strD = "Hello\u{1f650}, NSString" as NSString
> var rangeA = 
> strA.rangeOfCharacterFromSet(NSCharacterSet.whitespaceCharacterSet()) // 
> {Some “7..<8”}
> var rangeB = 
> strB.rangeOfCharacterFromSet(NSCharacterSet.whitespaceCharacterSet()) // (7,1)
> var rangeC = 
> strC.rangeOfCharacterFromSet(NSCharacterSet.whitespaceCharacterSet()) // 
> {Some “8..<9”}
> var rangeD = 
> strD.rangeOfCharacterFromSet(NSCharacterSet.whitespaceCharacterSet()) // (8,1)

So, yes, these are NSString indexes all the way, even if the result is packaged 
as a Range<String.Index>.



_______________________________________________

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

This email sent to arch...@mail-archive.com

Reply via email to