编码为 base64字符串和解码为 NSData Base64 Encoding and Decoding
1 2 3 4 5 6 7
| NSString *string = @"www.xfmwk.com"; NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding]; NSString *base64EncodedString = [EFUtils dataBase64EncodingWith:data]; NSData *dataBase64 = [EFUtils dataBase64DecodingFrom:base64EncodedString]; LOG_FORMAT(@"1: %@", base64EncodedString); LOG_FORMAT(@"2: %@", dataBase64); LOG_FORMAT(@"3: %@", [[NSString alloc] initWithData:dataBase64 encoding:NSUTF8StringEncoding]);
|
输出结果
1: d3d3LnhmbXdrLmNvbQ==
2: {length = 13, bytes = 0x7777772e78666d776b2e636f6d}
3: www.xfmwk.com
相关
更新内容
相关链接调整。