Re: Create an NSCharacterSet constant
Re: Create an NSCharacterSet constant
- Subject: Re: Create an NSCharacterSet constant
- From: John Joyce <email@hidden>
- Date: Mon, 2 Nov 2009 01:03:25 -0600
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