View Single Post
  #2   Report Post  
Myrna Larson
 
Posts: n/a
Default

Me, I prefer a more pointer-like approach, and I prefer to keep error
checking outside loops.


I'd call this a translation table rather than pointers. For the digits that
are not doubled, the digit N is translated to N + 1. For digits to be doubled,
you translate N to N * 2 + 1. In both cases, you subtract 9 if the result is
9.

Interestingly enough, the calls to Substitute and the Like function are so
slow that with this particular problem, it's actually faster to do the error
checking in-line. And that's in spite of your loop executing only half as many
times.