-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathNSString+Coby.h
More file actions
19 lines (16 loc) · 802 Bytes
/
NSString+Coby.h
File metadata and controls
19 lines (16 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#import <Foundation/Foundation.h>
@interface NSString (Coby)
// If length is greater than the length of `self`, returns a
// new `NSString` of length `length` with `self` centered
// and padded with `paddedString` otherwise, returns `self`.
- (NSString *)center:(NSInteger)length;
- (NSString *)center:(NSInteger)length withPaddedString:(NSString*)paddedString;
// Returns the index of the first occurrence of the given
// substring or in `self`. Returns `-1` if not found.
// If the second parameter is present, it specifies the
// position in the string to begin the search.
- (NSUInteger)index:(NSString *)subString;
- (NSUInteger)index:(NSString *)subString startingAt:(NSUInteger)startingIndex;
// Returns a new string with the characters from str in reverse order.
- (NSString *)reverse;
@end