dream cat7 wrote:

 > I agree that to be able to use that syntax is highly desirable, and
 indeed missing from all the cocoa libraries that I have looked at. One
 way would be a category addition to NSString class, which would call
 the  perl -pe 's/\b(.*?)/\u\L$1/g' for you and return the result as an
 NSString...

 But unfortunately nobody has come up that type of an extension to
 NSString yet.
 Or are there and c-libraries that will accept this s//// syntax ?


Well, Terry Jones wrote a routine called "strsed" in 1990 that in fact does this:

http://www.jones.tc/personal/odds-and-ends.html

It was loosely modeled on sed(1). It's a C routine that has this format:

str = strsed(string, command, option);

The strings is something like "Hello world". The command is of the form:

s/search/replace/ or g/search/replace/

The "s" version finds the first match and replaces it. The "g" version finds and replaces every occurrence. It uses the regex(3) library.

That's the good part. The bad part is that uses the older simpler regex capability. I'm in the process of modernizing this code to use the POSIX mode of regex(3), and hope to have it done next week. I will eventually put it on my not-yet-done web site and support it (maybe a small ObjC class for use with the icu library too).

In the mean time, email me if you want version 1 (couple of days). It will be released with a very permissive license as the base code was totally open source.

David
_______________________________________________

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

This email sent to [EMAIL PROTECTED]

Reply via email to