Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Create an NSCharacterSet constant
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Create an NSCharacterSet constant




On Nov 1, 2009, at 11:59 PM, Kyle Sluder wrote:

On Sun, Nov 1, 2009 at 9:50 PM, John Joyce
<email@hidden> wrote:
Category, yeah, that's totally one way I thought about, but I was thinking
more of an enhancement request in Radar. I figured the nature of it
inheriting from NSObject implies there are some kind of optimizations under
the hood (otherwise we'd just use NSString and NSScanner right?).

An NSCharacterSet embodies the concept of "a set of characters." An NSString and NSScanner pair embodies the concept of "how I'm gonna find some characters in a string." The first is a value type, the second an implementation detail. NSCharacterSets are also useful for other things than just finding them in a string or other stream of data.

Seems like a useful one considering the characterSetWithCharactersInString:
method. Even if it were some sort of singleton class. Particularly useful in
input validation routines (things like highly structured serial numbers and
other identifiers, etc...)

I'm confused about what enhancement could be made that would not be highly specific to your application.

--Kyle Sluder
Not my application per se, but for more applications.
I see it as a useful thing to have predefined character sets that don't need to be managed.
It's still just as simple to create them, but it sure would be nifty to not have to and to manage them in a constants file.


At the very least, I will probably submit a radar on adding locale- specific standard sets.
The standard set is woefully Latin-centric.
Many languages do not use whitespace the same way (generally as word boundaries).
Many languages also do not have the concept of capitalization.


Japanese is one in which I happen to work.
There would be a multitude of sets that would make sense in Japanese for a multitude of super common purposes.


I know, some of this leads to things like tokenization.
Point being, if we look beyond English and Western Europe, and consider how much of programming is pushing text around, it certainly seems like a logical expansion that would be of benefit to a lot of people.
Maybe it's just me, not trying to hog the list.


If anybody has some good sets for consideration, I'll be happy to include them when I create that radar.
Beyond that, I'd be willing to produce and host open source sets for use, if anybody wants to contribute them (( send them off list )).
( anything locale-specific should ideally include localized documentation as well )
_______________________________________________


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


References: 
 >Create an NSCharacterSet constant (From: John Joyce <email@hidden>)
 >Re: Create an NSCharacterSet constant (From: Graham Cox <email@hidden>)
 >Re: Create an NSCharacterSet constant (From: John Joyce <email@hidden>)
 >Re: Create an NSCharacterSet constant (From: Kyle Sluder <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.