Sha256: d931c7414cf8e0d2ef6d960230c3c4149e934d779f4dbfb15f82343a930cd417
Contents?: true
Size: 724 Bytes
Versions: 9
Compression:
Stored size: 724 Bytes
Contents
#import "NSString+Trim.h" @implementation NSString (Trim) - (NSString *)stringByTrimmingStartWithCharactersInSet:(NSCharacterSet *)theCharacterSet { NSUInteger i = 0; NSUInteger length = [self length]; while (i < length && [theCharacterSet characterIsMember: [self characterAtIndex: i]]) { i++; } return i ? [self substringFromIndex: i] : self; } - (NSString *)stringByTrimmingEndWithCharactersInSet:(NSCharacterSet *)theCharacterSet { NSInteger length = [self length] - 1; while (length > 0 && [theCharacterSet characterIsMember: [self characterAtIndex: length]]) { length--; } return length > 0 ? [self substringToIndex: length + 1] : self; } @end
Version data entries
9 entries across 9 versions & 1 rubygems