Added -stringByReplacingCharactersInRange:withString: (Mac OS 10.5 method)

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31776 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Quentin Mathe 2010-12-25 19:31:05 +00:00
parent 8209004750
commit dfa04d7fb9
3 changed files with 22 additions and 0 deletions

View file

@ -1786,6 +1786,7 @@ handle_printf_atsign (FILE *stream,
range: searchRange];
return [copy makeImmutableCopyOnFail: NO];
}
- (NSString*)stringByReplacingOccurrencesOfString: (NSString*)replace
withString: (NSString*)by
{
@ -1796,6 +1797,18 @@ handle_printf_atsign (FILE *stream,
range: NSMakeRange(0, [self length])];
}
/**
* Returns a new string where the substring in the given range is replaced by
* the passed string.
*/
- (NSString*) stringByReplacingCharactersInRange: (NSRange)aRange
withString: (NSString*)by
{
id copy = [self mutableCopy];
[copy replaceCharactersInRange: aRange withString: by];
return [copy makeImmutableCopyOnFail: NO];
}
/**
* Returns a substring of the receiver from character at the specified
* index to the end of the string.<br />