× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.