mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-20 20:26:42 +00:00
([NSGCString -substringFromRange:]): New method, overrides superclass
method with more efficient implementation. (From Eric Norum.) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1706 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7f7b75786e
commit
d8fb0d2318
1 changed files with 14 additions and 0 deletions
|
@ -128,6 +128,20 @@
|
||||||
return (unichar) _contents_chars[index];
|
return (unichar) _contents_chars[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString*) substringFromRange: (NSRange)aRange
|
||||||
|
{
|
||||||
|
NSGMutableCString *s;
|
||||||
|
|
||||||
|
if (aRange.location > _count)
|
||||||
|
[NSException raise: NSRangeException format:@"Invalid location."];
|
||||||
|
if (aRange.length > (_count - aRange.location))
|
||||||
|
[NSException raise: NSRangeException format:@"Invalid location+length."];
|
||||||
|
s = [[NSGMutableCString alloc] initWithCapacity:aRange.length+1];
|
||||||
|
[s setCString:_contents_chars+aRange.location length:aRange.length];
|
||||||
|
[s autorelease];
|
||||||
|
return (NSString *)s;
|
||||||
|
}
|
||||||
|
|
||||||
// FOR IndexedCollection SUPPORT;
|
// FOR IndexedCollection SUPPORT;
|
||||||
|
|
||||||
- objectAtIndex: (unsigned)index
|
- objectAtIndex: (unsigned)index
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue