mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
03ce3635cb
- Fixed a crash where an offset wrapped around when deleting the opening bracket - Backspacing now skips over formatting characters - Cursor position is maintained more accurately when reformatting - Added a few utility methods - Also fixed a test not having "test" as a prefix, causing it not to run //FREEBIE
25 lines
964 B
Objective-C
25 lines
964 B
Objective-C
#import <Foundation/Foundation.h>
|
|
|
|
@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;
|
|
-(NSData*) decodedAsJsonIntoData;
|
|
-(NSDictionary*) decodedAsJsonIntoDictionary;
|
|
-(NSData*) decodedAsHexString;
|
|
-(NSData*) decodedAsSpaceSeparatedHexString;
|
|
-(NSData*) decodedAsBase64Data;
|
|
-(NSNumber*) tryParseAsDecimalNumber;
|
|
-(NSNumber*) tryParseAsUnsignedInteger;
|
|
-(NSString*) removeAllCharactersIn:(NSCharacterSet*)characterSet;
|
|
-(NSString*) digitsOnly;
|
|
-(NSString*) withCharactersInRange:(NSRange)range replacedBy:(NSString*)substring;
|
|
|
|
@end
|