//屏幕上显示东西
NSLog(@"%d",myint);
// NSstring 转 NSdata
NSString *aString = @"1234abcd";
NSData *aData = [aString dataUsingEncoding: NSUTF8StringEncoding];
// NSMutableData NSData 转换
NSData *data=[[NSData alloc]init];
NSMutableData *mdata=[[NSMutableData alloc]init];
mdata=[NSData dataWithData:data];
//NSString转换 NSMutableData
NSMutableData *data;
NSString *myString = @"Some text";
data = [NSMutableData dataWithBytes:[myString cString] length:[myString length]];
//解决中文乱码,用GBK
NSStringEncoding enc =
CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
NSString *retStr = [[NSString alloc] initWithData:data encoding:enc];
aString=[NSString stringWithFormat:@"┃发站┃%-12s┃到站┃%-14s┃\n" "杭州" "宝应"];
//NSMutableData 清空
[data resetBytesInRange:NSMakeRange(0, [data length])];
NSLog(@"%d",myint);
// NSstring 转 NSdata
NSString *aString = @"1234abcd";
NSData *aData = [aString dataUsingEncoding: NSUTF8StringEncoding];
// NSMutableData NSData 转换
NSData *data=[[NSData alloc]init];
NSMutableData *mdata=[[NSMutableData alloc]init];
mdata=[NSData dataWithData:data];
//NSString转换 NSMutableData
NSMutableData *data;
NSString *myString = @"Some text";
data = [NSMutableData dataWithBytes:[myString cString] length:[myString length]];
//解决中文乱码,用GBK
NSStringEncoding enc =
CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
NSString *retStr = [[NSString alloc] initWithData:data encoding:enc];
aString=[NSString stringWithFormat:@"┃发站┃%-12s┃到站┃%-14s┃\n" "杭州" "宝应"];
//NSMutableData 清空
[data resetBytesInRange:NSMakeRange(0, [data length])];
[data setLength:0];
延时
[NSThread sleepForTimeInterval:3]