Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Alphabetic numbering system
Message
De
09/01/1999 17:15:01
 
 
À
09/01/1999 07:07:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00174074
Message ID:
00174392
Vues:
29
>>I am faced with the need to create (actually participate with) an alphabetic numbering system. The sequence is straight forward, and looks like this:
>>
>>AAAA
>>AAAB
>>.
>>.
>>AAAZ
>>AABA
>>
>>etc.
>>
>>Really my only need is to be able to increment these codes by one, so I need a function that receives "DPRZ" and returns "DPSA". Get it?
>>
>>I am fairly confident that I can pound out the code to do this, but all of my ideas so far would take an enormous amount of code- can anybody think of a practical solution?
>
>
>PARAMETERS PassedValue
>LOCAL ReturnValue, i
>
>#define BASELEN 4 && format AAAA (4 char long)
>#define BASEBASE 26
>#define BASEMIN 65
>#define BASEMAX 90
>
>
> * Convert numeric to binary or number character ID.
> ReturnValue = ""
> FOR i = 1 TO BASELEN
> ReturnValue = CHR(INT((m.PassedValue%( BASEBASE^i ))/;
> (BASEBASE^( i-1))) +;
> BASEMIN) + ReturnValue
> ENDFOR
>
>RETURN ReturnValue


Great minds think alike, Peter, take a look at the other messages in the thread to see what I (eventually came up with. It was a very interesting to see how many different ways different people tackled the problem.
Erik Moore
Clientelligence
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform