I don't really see the benefit to any sort of 'increment one portion of the string and throw the rest away' scheme unless you're actively trying to confuse people by sometimes incrementing and returning the whole value and other times only incrementing and returning part of it. Since there's no real way to get it to reliably do the Right Thing without adding more syntax (e.g., something like ++[1]$foo for first part, ++[-1]$foo for the last part), it should at least be immediately clear what happened when it does a Wrong Thing. Incrementing 14 floz to 15 floz and 1-OCT-2007-RevA to 2-OCT-2007-RevA makes it much clearer what's going on than incrementing them to just 15 and 2, even aside from the minor detail that the non-truncated results are sometimes correct.
1 ...although it's really just incrementing the first segment of the value which matches the pattern, which is correct in your example, but incorrect in others
In reply to Re^2: String increment - reasoning
by dsheroh
in thread String increment - reasoning
by throop
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |