Xcode Decimal x.x.x

510 Views Asked by At

xcode can use Decimal 3 place?

Example:

NSDecimal *test = 1.0.0; //not work
double test = 1.0.0; //not work
float test = 1.0.0; //not work

Can I use decimal 3 place in xcode?

2

There are 2 best solutions below

3
On

Version numbers like 1.0.3 are neither floating point nor decimal numbers. If you need to store them in a variable, use a string:

NSString *test = @"1.0.0";
0
On

Use string and componentsSeparatedByString: method and then convert each object in array to appropriate format.