Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hashing alphanumeric string...
Message
 
À
17/09/2003 10:14:31
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00829843
Message ID:
00829869
Vues:
24
>Or, you could convert the string "001BT007" as follows. Treat each letter as two digits. That is, from right to left: multiply 7 by 1, 0 by 10, 0 by 100, "T" (perhaps its ASCII value) by 1000, "B" by 100,000, 1 by 1e6, 0 by 1e7, 0 by 1e8. Note that for a 4-byte integer, your highest integer value is ca. 2e9.
>
>Also, I am assuming that all codes use the same format (e.g., 3 digits, 2 letters, 3 digits).
>
This is me solution. I like you opinion on it.
FUNCTION PKID
LPARAMETERS tcString

LOCAL lnumero,z

lnumero = 100000  && We what the value in the 100 000
FOR z = 1 TO LEN(tcString)
    lnumero = lnumero + ASC(SUBSTR(UPPER(tcString),z,1))
ENDFOR
RETURN lnumero
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform