Tuesday, February 1, 2011

Display Commas in a float value in a text field

NSNumberFormatter *frm = [[NSNumberFormatter alloc] init];
    [frm setNumberStyle:NSNumberFormatterCurrencyStyle];
    [frm setCurrencySymbol:@"$"];
    [frm setMaximumFractionDigits:2];
    NSString *formatted = [frm stringFromNumber:[NSNumber numberWithInt:100000]];

No comments:

Post a Comment