Changeset 6190

Show
Ignore:
Timestamp:
10/07/08 17:25:36 (2 months ago)
Author:
morris
Message:

Add replacement convenience methods

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/WiredAdditions/WiredFoundation/NSString-WIFoundation.h

    r5776 r6190  
    9292@interface NSMutableString(WIFoundation) 
    9393 
     94- (NSUInteger)replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement; 
     95- (NSUInteger)replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(unsigned int)options; 
    9496- (void)removeSurroundingWhitespace; 
    9597 
  • trunk/WiredAdditions/WiredFoundation/NSString-WIFoundation.m

    r5788 r6190  
    593593@implementation NSMutableString(WIFoundation) 
    594594 
     595- (NSUInteger)replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement { 
     596        return [self replaceOccurrencesOfString:target withString:replacement options:0 range:NSMakeRange(0, [self length])]; 
     597} 
     598 
     599 
     600 
     601- (NSUInteger)replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(unsigned int)options { 
     602        return [self replaceOccurrencesOfString:target withString:replacement options:options range:NSMakeRange(0, [self length])]; 
     603} 
     604 
     605 
     606 
    595607- (void)removeSurroundingWhitespace { 
    596608        [self setString:[self stringByRemovingSurroundingWhitespace]];