NSString 轉 byte字節數組
NSData *strDataBytes = [@"$$" dataUsingEncoding:NSUTF8StringEncoding];app
轉換結果爲{0x24, 0x24};spa
int 轉 bytestring
NSMutableData *myData = [[NSMutableData alloc] init];it
int num = 1024;table
[myData appendBytes:&num length:sizeof(num)];coding
Byte數組 轉 NSDatatab
Byte *bytes = {***};di
NSData *strData = [NSData dataWithBytes:bytes length:strlen];
encoding
NSData 轉 NSString
NSData *strData = ***;
NSString* string = [[NSString alloc] initWithData:strData encoding:NSUTF8StringEncoding];