Add factory method that returns data with blank C string

This commit is contained in:
achmizs 2015-12-24 23:31:03 -05:00
parent 12e20fbab5
commit 04f57f59ef
2 changed files with 10 additions and 0 deletions

View File

@ -87,4 +87,9 @@
*/
@property (readonly) NSData *SA_dataWithUnterminatedByteString;
/** Returns an NSData object containing a blank C string (i.e. a byte sequence
of length 1, containing the null character '\0').
*/
+(NSData *)dataWithBlankCString;
@end

View File

@ -75,4 +75,9 @@
}
}
+(NSData *)dataWithBlankCString
{
return [NSData dataWithBytes:"\0" length:1];
}
@end