如何将NSNumber转换为NSString [英] How to convert NSNumber to NSString
本文介绍了如何将NSNumber转换为NSString的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我有一个NSArray
"myArray"和NSNumber
s和NSString
s.我需要在另一个UIView
中使用它们,所以我会这样:
So I have an NSArray
"myArray" with NSNumber
s and NSString
s. I need them in another UIView
so i go like this:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
DetailViewController *details = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:nil];
details.subjectText = [[myArray objectAtIndex:indexPath.row] objectForKey:@"subject"];
subjectText有效.
但是,如何从中取出NSNumber
? (我实际上需要将它们作为字符串...)
我会像这样从NSNumber
转换出NSString
:
NSString *blah = [NSNumber intValue]
.但是我不知道如何在上面的代码中进行设置...
The subjectText works.
But how can I get the NSNumber
s out of it? (I actually need them as strings...)
I would convert a NSString
out of a NSNumber
like this:
NSString *blah = [NSNumber intValue]
. But I don't know how to set it up in the code above...
推荐答案
尝试:
NSString *myString = [NSNumber stringValue];
这篇关于如何将NSNumber转换为NSString的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文