diff options
Diffstat (limited to 'Source/SPStringAdditions.h')
-rw-r--r-- | Source/SPStringAdditions.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/SPStringAdditions.h b/Source/SPStringAdditions.h index 5f1c0e6d..a5b1b468 100644 --- a/Source/SPStringAdditions.h +++ b/Source/SPStringAdditions.h @@ -78,6 +78,13 @@ static inline id NSMutableAttributedStringAttributeAtIndex(NSMutableAttributedSt - (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet *)charSet; - (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet *)charSet options:(NSUInteger)mask; +/** + * Replace all occurances of any character in set with the replacement string + * @param set Characters to look for (MUST NOT be nil) + * @param string A replacement string (can be nil == empty string) + * @return A string with replacements applied + */ +- (NSString *)stringByReplacingCharactersInSet:(NSCharacterSet *)set withString:(NSString *)string; - (CGFloat)levenshteinDistanceWithWord:(NSString *)stringB; @@ -88,6 +95,10 @@ static inline id NSMutableAttributedStringAttributeAtIndex(NSMutableAttributedSt * Namely the following options will be applied when matching: * NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch|NSWidthInsensitiveSearch * Additionaly this method might match even when it should not. + * A regular substring test is always included. Therefore looking e.g. for "abc" in + * "axbxabc" would match as (axbx,"abc") and NOT as ("a",x,"b",xab,"c"). + * Partial submatches will likewise be optimized to return as few matches as possible. + * E.g. ".123" in "a._1_12_123" will return (a,".",_1_12_,"123") NOT (a,".",_,"1",_1,"2",_12,"3") * * @param other String to match against self * @param submatches Pass the pointer to a variable that will be set to an NSArray * |