Re: Swift: How to determine if a Character represents whitespace?
Re: Swift: How to determine if a Character represents whitespace?
- Subject: Re: Swift: How to determine if a Character represents whitespace?
- From: Roland King <email@hidden>
- Date: Sat, 04 Apr 2015 10:35:07 +0800
ok here’s my try, assuming NSLinguisticTagger knows what it’s doing. And yes it’s a bit stupid to use a linguistic tagger to do something like that but .. whatever
var str = "Some String WIth Whitespace "
var lt = NSLinguisticTagger( tagSchemes: [NSLinguisticTagSchemeTokenType], options: 0 )
lt.string = str
var endsWithWhitespace = ( lt.tagAtIndex( (str as NSString).length-1, scheme: NSLinguisticTagSchemeTokenType, tokenRange: nil, sentenceRange: nil ) == NSLinguisticTagOtherWhitespace )
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden