ios - Convert NSString to NSInteger -


i have

nsstring *stramount = @"10.00"; nsinteger totalamount = totalamount + [stramount integervalue]; 

the output is

totalamount = 80

but want output totalamount = 10

  1. first of totalamount should not of pointer type.
  2. variable 'totalamount' uninitialized when used within own initialization

replace code with

nsstring *stramount = @"10.00"; nsinteger totalamount =  0; totalamount = totalamount + [stramount integervalue];  nslog(@" %ld",(long)totalamount); 

output = 10


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -