Robert Munday escribió:
Without using arrays (I can do that), is there a way to increment a character value?
CHAR = 'A';
CHAR += 1;
does not work, but is there something similar which would? I am adding a two-character suffix to a field which increments `AA`, `AB`, `AC` etc.
Robert, a similar problem (kind of...) back in May had lots of posts.
I contributed with one post (in the archive)

http://archive.midrange.com/rpg400-l/200805/msg00514.html

which I called "AlphaMath". I must admit not many people thought it was a good solution, but...
In that post, the "code" was 4 positions, KLMN, ... K, L being alpha A-Z, but M, N numeric 0-9
Your case, the "suffix" is only 2 positions and will go from 'AA' to 'ZZ', which gives 676 combinations (26x26). Am I right?
This should be easier, but similar.
...
Table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' (26 letters)
...
counter = 0 (Starting a counter from 0...)
...
<loop>
j = counter\26 (integer division !)
i = counter mod 26 (remainder prom previous integer division!)
First suffix letter = Table, with displacement "i"
Second suffix letter = Table, with displacement "j"
....
counter = counter + 1 </loop>

HTH


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].