Ok…. This seems like a simple question but I can’t find any info about it so I thought I would ask here.
I am trying to store a number (int) in a var but I need to keep the 0’s before it
eg:
int x = 0001;
NSLog(@"%i",x) // returns 1
Is it possible to make it return 0001?
I know that i can do this:
NSLog(@"%04i",x); // returns 0001
But that is not quite the answer i am looking for because the number of 0’s needs to vary.
I don’t specifically need to use an int but it would need to be a whole number.
If you need the string, rather than the value, you need to use a string variable.
Then when you need to do some calculations, use “[x intValue]”.