From d093bf9a21675e4d10135c7b5400cefb349282f3 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 30 Dec 2017 11:23:04 -0800 Subject: [PATCH] =?UTF-8?q?Add=20rs=5FdebugStringWithData=20=E2=80=94=20to?= =?UTF-8?q?=20use=20when=20debugging.=20A=20quick=20way=20to=20turn=20data?= =?UTF-8?q?=20into=20a=20string.=20It=20will=20work=20most=20of=20the=20ti?= =?UTF-8?q?me.=20Good=20enough=20for=20debugging.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frameworks/RSCore/RSCore/NSString+RSCore.h | 2 ++ Frameworks/RSCore/RSCore/NSString+RSCore.m | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/Frameworks/RSCore/RSCore/NSString+RSCore.h b/Frameworks/RSCore/RSCore/NSString+RSCore.h index 1a454fa89..28a237649 100755 --- a/Frameworks/RSCore/RSCore/NSString+RSCore.h +++ b/Frameworks/RSCore/RSCore/NSString+RSCore.h @@ -76,6 +76,8 @@ typedef struct { - (NSString *)rs_stringByStrippingHTTPOrHTTPSScheme; ++ (NSString *)rs_debugStringWithData:(NSData *)d; // Assume it’s UTF8, at least for now. Good enough for most debugging purposes. + @end NS_ASSUME_NONNULL_END diff --git a/Frameworks/RSCore/RSCore/NSString+RSCore.m b/Frameworks/RSCore/RSCore/NSString+RSCore.m index 9e2ed073d..b81b3180f 100755 --- a/Frameworks/RSCore/RSCore/NSString+RSCore.m +++ b/Frameworks/RSCore/RSCore/NSString+RSCore.m @@ -416,6 +416,10 @@ NSString *RSStringReplaceAll(NSString *stringToSearch, NSString *searchFor, NSSt return s; } ++ (NSString *)rs_debugStringWithData:(NSData *)d { + + return [[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding]; +} @end