Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Keeping the zero on the left after val ( )
Message
 
À
04/10/2007 08:22:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01258472
Message ID:
01258480
Vues:
15
Please take a look at the code below:

** the last one is the verify digit


LN = VAL (DIRETO.REG)
endif


FOR lnCounter = 1 TO LEN(ALLTRIM(STR(ln)))
lcVarName = 'lcVarName' + ALLTRIM(STR(lnCounter))
&lcVarName = INT(VAL(substr(trans(ln),lnCounter,1)))
ENDFOR

R1 = lcVarName1
R2 = lcVarName2
R3 = lcVarName3
R4 = lcVarName4
R5 = lcVarName5
R6 = lcVarName6
R7 = lcVarName7
R8 = lcVarName8
DV = lcVarName9


Sum = (R1 * 8) + (R2 * 6) + (R3 * 4) + (R4 * 2) + (R5 * 3) + (R6 * 5) + (R7 * 9) + (R8 * 7)

REST1 = MOD(Sum, 11)

DO CASE
CASE REST1 = 0
DV1 = 5
CASE REST1 = 1
DV1 = 0
OTHER
DV1 = 11 - REST1
ENDCASE

IF DV1 # DV

= MESSAGEBOX ("invalid code")
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform