How to convert an NSString into an NSNumber

后端 未结 18 2353
一整个雨季
一整个雨季 2020-11-22 16:56

How can I convert a NSString containing a number of any primitive data type (e.g. int, float, char, unsigned int

18条回答
  •  旧巷少年郎
    2020-11-22 17:23

    You can just use [string intValue] or [string floatValue] or [string doubleValue] etc

    You can also use NSNumberFormatter class:

提交回复
热议问题