ios - How to add/sum hours from array in Objective C -


i new ios programming , stuck on simple cant find answer anywhere ...i need pls. have array , has hours store in like- 11:30 13:45 18:00 23:05 how can add/sum ?

thanks in advance.

how this:

nsinteger total = 0; nsarray *arr = @[@"11:30", @"13:45", @"18:00", @"23:05"]; (nsstring *anhour in arr) {     nsarray *splitstring = [anhour componentsseparatedbystring:@":"];     nsinteger minutes = [splitstring[0] integervalue]*60  + [splitstring[1] integervalue];     total += minutes; } nslog(@"total hours are: %f",total/60.0); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -