//字符串转int float
NSString *strInt = @"123";
int a = [strInt intValue];
float b = [strInt floatValue];
NSLog(@"字符串转int:%d 转float:%.f\n",a,b);
//int 转字符串
strInt = [NSString stringWithFormat:@"%d",a];
NSLog(@"int转字符串:%@\n",strInt);
//字符串对象 转 c风格字符串
const char *c = [str UTF8String];
printf("%s\n",c);
//c风格字符串转 字符串对象
strInt = [NSString stringWithCString:c encoding:NSUTF8StringEncoding];
NSLog(@"c风格转换为字符串对象:%@\n",strInt);
//NSdata 转byte
NSData * data3 = [str dataUsingEncoding:NSUTF8StringEncoding];
Byte *byte = (Byte *)[data3 bytes];
NSLog(@"打印byte数组:%s\n",byte);
//byte转NSString
str = [NSString stringWithFormat:@"%s",byte];
NSLog(@"byte数组转字符串:%@\n",str);