NSData和NSString 、 NSFileManager】的更多相关文章

// 字符串转Data NSString *str =@"jesfds"; NSData *data =[str dataUsingEncoding:NSUTF8StringEncoding]; //NSData 转NSString NSString *result =[[ NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; //data 转char NSData *data; char *test=[da…
iOS中,将NSData转NSString的一般方法为[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];但是当data中包含00时,所获得的新字符就会为nil,这时我们应该这样转 [NSString stringWithUTF8String:[data bytes]];…
1,NSData 与 NSString NSData --> NSString NSString *aString = [[NSString alloc] initWithData:adata encoding:NSUTF8StringEncoding]; NSString --> NSData NSString *aString = @"1234"; NSData *aData = [aString dataUsingEncoding: NSUTF8StringEncod…
1.UIImage转换为NSData NSData *data;if (UIImagePNGRepresentation(image) == nil) { data = UIImageJPEGRepresentation(image, 1); } else { data = UIImagePNGRepresentation(image);} 2.NSData转换为NSString NSString *str=[[NSString alloc]initWithData:data];…
// NSData NSDate NSString NSArray NSDictionary json NSString *string = @"hello word"; NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding]; NSArray *array = [NSArray arrayWithObjects:@"1",@"2",@"3",nil]; N…
1. NSData 与 NSStringNSData-> NSStringNSString *aString = [[NSString alloc] initWithData:adata encoding:NSUTF8StringEncoding]; NSString->NSDataNSString *aString = @"1234abcd";NSData *aData = [aString dataUsingEncoding: NSUTF8StringEncoding]…
1. NSData 与 NSString NSData-> NSString NSString *aString = [[NSString alloc] initWithData:adataencoding:NSUTF8StringEncoding]; NSString->NSData NSString *aString = @"1234abcd"; NSData *aData = [aString dataUsingEncoding: NSUTF8StringEncodi…
,NSData 与 NSString NSData --> NSString NSString *aString = [[NSString alloc] initWithData:adata encoding:NSUTF8StringEncoding]; NSString --> NSData NSString *aString = "; NSData *aData = [aString dataUsingEncoding: NSUTF8StringEncoding]; ,NSDat…
//NSData转换为UIImage NSData *imageData = [NSData dataWithContentsOfFile: imagePath]; UIImage *image = [UIImage imageWithData: imageData]; //UIImage转换为NSData NSData *imageData = UIImagePNGRepresentation(aimae); . 字符串转Data NSString * str =@"str"; NS…
//    NSData  NSDate NSString NSArray NSDictionary json NSString *string = @"hello word"; NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding]; NSArray *array = [NSArray arrayWithObjects:@"1",@"2",@"3",nil…