diff --git a/Source/NSGCString.m b/Source/NSGCString.m index f3d98bc30..7f3bef8b0 100644 --- a/Source/NSGCString.m +++ b/Source/NSGCString.m @@ -128,6 +128,20 @@ 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; - objectAtIndex: (unsigned)index