Hi All,
Not sure if this is the best approach but I have some string which represents the orientation of some blocks. For example '3V6V' means a row of 3 vertical blocks, and a row of 6 vertical blocks. '3V6V6V' means row of 3, 6, 6 all vertical. '4H4H4H4H' would be 4 rows of 4 horizontal blocks. i.e. every 2 characters constitutes a row. Each item will either have just horizontals or just verticals, no mix and match. What I need to do here is add the total of the digits to determine the total number of blocks. How can I do that? I was thinking do some kind of string.split() and then if an array item is a number, add it to a running total. Is there a better approach to this? '4H4H4H4H' would be 16 and '3V6V6V' would be 15. Can someone point me in the right direction? There must be a fairly easy way to do this.
Thanks,
~ck in San Diego