2017-05-05 00:17:18 +02:00
|
|
|
//
|
|
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2014-05-06 19:41:08 +02:00
|
|
|
@interface NSString (Util)
|
2014-08-31 21:21:55 +02:00
|
|
|
|
2014-05-06 19:41:08 +02:00
|
|
|
/// The utf-8 encoding of the string's text.
|
2015-12-22 12:45:09 +01:00
|
|
|
- (NSData *)encodedAsUtf8;
|
2014-05-06 19:41:08 +02:00
|
|
|
/// The ascii encoding of the string's text.
|
|
|
|
/// Throws when the string contains non-ascii characters.
|
2015-12-22 12:45:09 +01:00
|
|
|
- (NSData *)encodedAsAscii;
|
|
|
|
- (NSRegularExpression *)toRegularExpression;
|
|
|
|
- (NSString *)withMatchesAgainst:(NSRegularExpression *)regex replacedBy:(NSString *)replacement;
|
|
|
|
- (bool)containsAnyMatches:(NSRegularExpression *)regex;
|
|
|
|
- (NSString *)withPrefixRemovedElseNull:(NSString *)prefix;
|
2017-05-05 00:17:18 +02:00
|
|
|
|
2015-12-22 12:45:09 +01:00
|
|
|
- (NSDictionary *)decodedAsJsonIntoDictionary;
|
2017-05-05 00:17:18 +02:00
|
|
|
|
2015-12-22 12:45:09 +01:00
|
|
|
- (NSNumber *)tryParseAsDecimalNumber;
|
|
|
|
- (NSNumber *)tryParseAsUnsignedInteger;
|
|
|
|
- (NSString *)removeAllCharactersIn:(NSCharacterSet *)characterSet;
|
|
|
|
- (NSString *)digitsOnly;
|
|
|
|
- (NSString *)withCharactersInRange:(NSRange)range replacedBy:(NSString *)substring;
|
2014-05-06 19:41:08 +02:00
|
|
|
|
|
|
|
@end
|