Trimming certain patterns from NSString?

2011-07-18 Thread Eric E. Dolecki
I am collecting track information (titles) and I would like to trim off certain things 01 - Barracuda becomes Barracuda 02 - Love Alive becomes Love Alive What is the best way to trim those off the front? Thanks, Eric ___ Cocoa-dev mailing list

Re: Trimming certain patterns from NSString?

2011-07-18 Thread Dave DeLong
Regular Expression find and replace? Basically, replace something like @^\\d+ - with @. Dave On Jul 18, 2011, at 10:46 AM, Eric E. Dolecki wrote: I am collecting track information (titles) and I would like to trim off certain things 01 - Barracuda becomes Barracuda 02 - Love Alive

Re: Trimming certain patterns from NSString?

2011-07-18 Thread Vincent
Le 18 juil. 2011 à 19:46, Eric E. Dolecki a écrit : I am collecting track information (titles) and I would like to trim off certain things 01 - Barracuda becomes Barracuda 02 - Love Alive becomes Love Alive If your prefix is always XX - then you can use -[title

Re: Trimming certain patterns from NSString?

2011-07-18 Thread Eric E. Dolecki
Does this look about right? NSError *error = NULL; NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@^\\d+ - options:NSRegularExpressionCaseInsensitive error:error]; songTitle = [regex stringByReplacingMatchesInString:songTitle