Originally Posted by
Tom Beauford
Will M16* always be the start of what you are counting?
I believe that this is a list of metric bolts. You will need a list of all possible bolt sizes used and iterate the list of strings for each bolt size. Without knowing where the strings come from, you could make this problem modular. Create a function just for iterating the strings and leave the selection process for another function that calls the summing function.
So, Anjan, the logic would go something like this:
Code:
The function starts by accepting a list of bolts as an argument.
Then for each bolt in another list of stock bolt sizes,
For each string in the list of strings
get a substring to check the string to see if it is the right bolt size
if it is, then get a substring of the quantity and add it to a variable for that bolt size
Process next string
Process next bolt size
Format a list of strings of the quantities for each bolt size
Output as text ents