How get the total sum of currency from a NSMutableArray [duplicate]
问题 This question already has answers here : ios - How get the total sum of float from a NSMutableArray (3 answers) Closed 5 years ago . I want to sum of currency from NSMutableArray. Ex: I have an arrayA (1,234.56 , 2,345.67) and after sum items in array, I want result show: 3,580.23 to put it on the Label. Is there the way to implement this? Thanks 回答1: If the values are stored as NSNumber objects, you can use the collection operators. For example: NSArray *array = @[@1234.56, @2345.67];