How can I convert NSString into NSNumber. For ex. I have @”0100″, I want to convert it into NSNumber and as per my requirements, the result should be 0100 not 100. Is there any way to achieve this or I have to use NSString instead on NSNumber
Share
What do you mean by you need a NSNumber with value 0100, instead of 100? Does it make a difference that doesn’t agree with integer arithmetic? If so, then how, and if not, then do you mean that you have to output the number at some later time with the leading 0?
If so, then use the correct formatter while outputting the number, and don’t worry about it before.
If you need to store numeric characters exactly then use a NSString. Validate it before accepting or using it. Turning it into a number is not what you want to or mean to do.