gpt4 book ai didi

iphone - 从 NSString 创建 Unsigned Long Long

转载 作者:行者123 更新时间:2023-12-03 20:25:54 25 4
gpt4 key购买 nike

Possible Duplicate:
Storing and retrieving unsigned long long value to/from NSString

我正在尝试从字符串创建一个 unsigned long long ,这样我就可以在其他地方使用该值,但这样做不太幸运...这是我用来尝试此操作的内容

-(void)unsignedLongValue{


NSString *theString = [NSString stringWithFormat:@"%llu", [NSNumber
unsignedLongLongValue]];

theString = [[_message objectForKey:@"user"] objectForKey:@"id"];

NSLog(@"%llu");

}

如果您有任何建议或知道任何好的文章,如果您能告诉我,我将非常感激!谢谢!

最佳答案

您可能想这样做,

NSString * theString = [[[_message objectForKey:@"user"] objectForKey:@"id"];

NSNumberFormatter * numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
NSNumber * number = [numberFormatter numberFromString:theString];

NSLog(@"%llu", [number unsignedLongLongValue]);

关于iphone - 从 NSString 创建 Unsigned Long Long,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6448731/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com