session-ios/Signal/src/util/StringUtil.h
Matthew Chen 183f0f1ccd Respond to CR.
// FREEBIE
2017-09-19 17:45:18 -04:00

25 lines
879 B
Objective-C

//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
@interface NSString (Util)
/// The utf-8 encoding of the string's text.
- (NSData *)encodedAsUtf8;
/// The ascii encoding of the string's text.
/// Throws when the string contains non-ascii characters.
- (NSData *)encodedAsAscii;
- (NSRegularExpression *)toRegularExpression;
- (NSString *)withMatchesAgainst:(NSRegularExpression *)regex replacedBy:(NSString *)replacement;
- (bool)containsAnyMatches:(NSRegularExpression *)regex;
- (NSString *)withPrefixRemovedElseNull:(NSString *)prefix;
- (NSDictionary *)decodedAsJsonIntoDictionary;
- (NSNumber *)tryParseAsDecimalNumber;
- (NSNumber *)tryParseAsUnsignedInteger;
- (NSString *)removeAllCharactersIn:(NSCharacterSet *)characterSet;
- (NSString *)digitsOnly;
- (NSString *)withCharactersInRange:(NSRange)range replacedBy:(NSString *)substring;
@end