I have figure out this. you can do this as per below implementation.
Please take a look at below demo code...
NSArray * numbers = [[NSArray alloc] initWithObjects:@"1.1500",@"1.1000",@"1.0000",@"1.4710",@"1.4711",nil];
for (int i=0; i<[numbers count]; i++) {
NSArray * floatingPoint = [[numbers objectAtIndex:i] componentsSeparatedByString:@"."];
NSString * lastObject = [[floatingPoint lastObject] stringByReplacingOccurrencesOfString:@"0" withString:@""];
if ([lastObject length] < 2) {
NSLog(@"%@",[NSString stringWithFormat:@"$ %.2f",[[numbers objectAtIndex:i] floatValue]]);
} else {
NSLog(@"%@",[NSString stringWithFormat:@"$ %g",[[numbers objectAtIndex:i] floatValue]]);
}
}
Thanks,
MinuMaster