开发者

Converting an NSString to an NSInteger

开发者 https://www.devze.com 2023-01-10 21:20 出处:网络
if i have: NSString* number = @\"2000\"; Will NSInteger integerNumber = [numbe开发者_运维知识库r integerValue];

if i have:

NSString* number = @"2000";

Will NSInteger integerNumber = [numbe开发者_运维知识库r integerValue];

be equal to the integer representation of 2000?


Why not consult the documentation?

integerValue

Returns the NSInteger value of the receiver’s text.

- (NSInteger)integerValue

Return Value

The NSInteger value of the receiver’s text, assuming a decimal representation and skipping whitespace at the beginning of the string. Returns 0 if the receiver doesn’t begin with a valid decimal text representation of a number.


Yes, it will be.

0

精彩评论

暂无评论...
验证码 换一张
取 消