mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 09:41:15 +00:00
Added a couple of convenience methods on NSString (OS X 10.5 compatibility).
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29810 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3a49540942
commit
08c1acb850
2 changed files with 28 additions and 0 deletions
|
@ -280,6 +280,12 @@ typedef NSUInteger NSStringEncodingConversionOptions;
|
||||||
- (id) initWithContentsOfFile: (NSString*)path
|
- (id) initWithContentsOfFile: (NSString*)path
|
||||||
usedEncoding: (NSStringEncoding*)enc
|
usedEncoding: (NSStringEncoding*)enc
|
||||||
error: (NSError**)error;
|
error: (NSError**)error;
|
||||||
|
- (NSString*)stringByReplacingOccurrencesOfString: (NSString*)replace
|
||||||
|
withString: (NSString*)by
|
||||||
|
options: (NSStringCompareOptions)opts
|
||||||
|
range: (NSRange)searchRange;
|
||||||
|
- (NSString*)stringByReplacingOccurrencesOfString: (NSString*)replace
|
||||||
|
withString: (NSString*)by;
|
||||||
#endif
|
#endif
|
||||||
- (id) initWithCharactersNoCopy: (unichar*)chars
|
- (id) initWithCharactersNoCopy: (unichar*)chars
|
||||||
length: (NSUInteger)length
|
length: (NSUInteger)length
|
||||||
|
|
|
@ -1614,6 +1614,28 @@ handle_printf_atsign (FILE *stream,
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString*)stringByReplacingOccurrencesOfString: (NSString*)replace
|
||||||
|
withString: (NSString*)by
|
||||||
|
options: (NSStringCompareOptions)opts
|
||||||
|
range: (NSRange)searchRange
|
||||||
|
{
|
||||||
|
id copy = [self mutableCopy];
|
||||||
|
[copy replaceOccurrencesOfString: replace
|
||||||
|
withString: by
|
||||||
|
options: opts
|
||||||
|
range: searchRange];
|
||||||
|
return [copy makeImmutableCopyOnFail: NO];
|
||||||
|
}
|
||||||
|
- (NSString*)stringByReplacingOccurrencesOfString: (NSString*)replace
|
||||||
|
withString: (NSString*)by
|
||||||
|
{
|
||||||
|
return [self
|
||||||
|
stringByReplacingOccurrencesOfString: replace
|
||||||
|
withString: by
|
||||||
|
options: 0
|
||||||
|
range: NSMakeRange(0, [self length])];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a substring of the receiver from character at the specified
|
* Returns a substring of the receiver from character at the specified
|
||||||
* index to the end of the string.<br />
|
* index to the end of the string.<br />
|
||||||
|
|
Loading…
Reference in a new issue