Don_Mag icon

string format example

Don_Mag | PRO | 03/04/21 02:55:15 PM UTC | 0 ⭐ | 9953 👁️ | Never ⏰ | []
Objective C |

0 B

|

None

|

0 👍

/

0 👎

    NSNumber *quantity = [NSNumber numberWithDouble:1];
    NSNumber *price_vat = [NSNumber numberWithDouble:0.76];
    
    double totalPrice = 293;
    
    totalPrice = totalPrice + [quantity doubleValue] * [price_vat doubleValue];
    
    NSString *s = [NSString stringWithFormat:@"%0.2f", totalPrice];
    
    NSLog(@"total: %@", s);
    
    // in case we're testing without the IBOutlet connected,
    //  don't try to set its .text
    if (nil != self.priceLabel) {
        self.priceLabel.text = s;
    }
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎