in reply to Re: String increment - reasoning
in thread String increment - reasoning
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: String increment - reasoning
by Fletch (Bishop) on Oct 02, 2007 at 16:46 UTC | |
|
Re^3: String increment - reasoning
by shmem (Chancellor) on Oct 03, 2007 at 21:53 UTC | |
by eric256 (Parson) on Oct 03, 2007 at 23:39 UTC |