Cocoa has always been lacking in the RegEx department (at least the
'built-in' Cocoa classes, there's a bunch of third-party regex
frameworks), especially when compared to languages like Python. Since
your situation isn't very complex, I would just use the bread-n-butter
string APIs:

NSString *originalString = @"everything_else_is_my_name";
    NSArray *originalStringComponents,
            *resultingComponents;
    NSMutableString *result = [NSMutableString string];

    originalStringComponents = [originalString
componentsSeparatedByString: @"_"];

    for (NSString *currentStringComponent in originalStringComponents)
        [result appendString: [NSString stringWithFormat: @"%...@%@",
[currentStringComponent capitalizedString],

(currentStringComponent != [originalStringComponents lastObject] ? @"
" : @"")]];

    NSLog(@"%@", result);

(Better-formatted version here: http://pastie.org/444173).

Note that this snippet isn't incredibly efficient, but should get the
point across...

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 arch...@mail-archive.com

Reply via email to