I have a Dictionary with an Orders array with amount and orders in it Orders = ("3 White Shirts", "8 White Shirts", "4 blue shorts")
How would I loop through it and add the amount of duplicate orders so that the result string or array would be
Orders = ("11 White Shirts", "4 blue shorts") or myString ="11 White Shirts, 4 blue shorts"
I’m thinking some sort of substring to check if the products are the same but not sure how to capture the correct quantity to add from the duplicate order
Many thanks
Ok here is a way to do this (the shortest one I could think of):
This would give you a dict like this:
So you could iterate over the keys and produce an array of strings like this:
Which finally will give you:
PS. Don’t forget to release if you don’t use ARC !