Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

objective c conversion for NSString to NSDecimalNumber

can anybody say me the conversion for NSString to NSDecimalNumber

unsigned long long order;

        if (i==1) {

            order = [feeArray objectAtIndex:0];
        }
        if (i==2) {
            order = [amountArray objectAtIndex:0];
        }

thanks in advance

like image 410
user1501354 Avatar asked Jul 10 '12 07:07

user1501354


2 Answers

You can use NSDecimalNumber's decimalNumberWithString initializer to convert from a string

like image 103
lyptt Avatar answered Nov 15 '22 02:11

lyptt


Try this:

NSString *order = @"";
if (i==1) {
  order = [feeArray objectAtIndex:0];
}
if (i==2) {
  order = [amountArray objectAtIndex:0];
}

NSDecimalNumber *decimal = [NSDecimalNumber decimalNumberWithString:order];
like image 23
DLende Avatar answered Nov 15 '22 02:11

DLende