Add rs_debugStringWithData — to use when debugging. A quick way to turn data into a string. It will work most of the time. Good enough for debugging.

This commit is contained in:
Brent Simmons 2017-12-30 11:23:04 -08:00
parent 0c54e61fbc
commit d093bf9a21
2 changed files with 6 additions and 0 deletions

View File

@ -76,6 +76,8 @@ typedef struct {
- (NSString *)rs_stringByStrippingHTTPOrHTTPSScheme; - (NSString *)rs_stringByStrippingHTTPOrHTTPSScheme;
+ (NSString *)rs_debugStringWithData:(NSData *)d; // Assume its UTF8, at least for now. Good enough for most debugging purposes.
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@ -416,6 +416,10 @@ NSString *RSStringReplaceAll(NSString *stringToSearch, NSString *searchFor, NSSt
return s; return s;
} }
+ (NSString *)rs_debugStringWithData:(NSData *)d {
return [[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding];
}
@end @end