Sorry, I don't know Java, but today I ran into the same problem, so I wrote this (this is in C #)
public string IncrementString(string inboundString) { byte[] bytes = System.Text.Encoding.ASCII.GetBytes(inboundString.ToArray); bool incrementNext = false; for (l = -(bytes.Count - 1); l <= 0; l++) { incrementNext = false; int bIndex = Math.Abs(l); int asciiVal = Conversion.Val(bytes(bIndex).ToString); asciiVal += 1; if (asciiVal > 57 & asciiVal < 65) asciiVal = 65; if (asciiVal > 90) { asciiVal = 48; incrementNext = true; } bytes(bIndex) = System.Text.Encoding.ASCII.GetBytes({ Strings.Chr(asciiVal) })(0); if (incrementNext == false) break;
Matth3w Sep 02 '16 at 7:51 on 2016-09-02 07:51
source share