Should I just convert the entire string to ascii and increment there?
Melinda Deering wrote:I'm not sure...I think ascii.
I modified some code that someone shared with me that seems to do a similar kind of thing and I'll paste it below.
Melinda Deering wrote:I have an assignment where I need to increment an alphanumeric string by one. For example AAA123 + 1 = AAA124. I'm okay with incrementing alpha or incrementing numbers, but incrementing them all together is where I am stuck. Should I just convert the entire string to ascii and increment there? Any nudge in the right direction will be appreciated.
Melinda Deering wrote:It's actually a project to increment license plate numbers, so AAA123 becomes AAA124.
Roland Shield wrote:But again, I am only here because: A) there seem to be people knowing how to wrestle with the problem B) I need answers.
I am using three softwares: ESRI ArcSDE/ArcGIS, MAXIMO, and FME. The first one is "friendly" with Python, the second is not friendly, and the third is "friendly" with tcl and Python.
Roland Shield wrote:So, does that clarify a more full understanding of the problem?
And when I say "problem", that seems like a strong word to me. Why? Well, for one, get this-- the magic function in MS Excel does the following, which is cool- say your last record was 'Banana00098' and you want add three more pieces of fruit and they also happened to be, in this case 3 more bananas. And so what does it do? Well, on-the-fly, it adds the following 'Banana00099', 'Banana00100', 'Banana00101' !