using the STRCHECKSUM command

I am having trouble getting this command to work. I am using it on credit card numbers. Can anyone see a problem with my code? It works on my test number 4039383736353431 - check digit is included (1). But not on a valid credit card number. Here is the code: //checkdigit IF CreditCardNo = '' THEN EXIT(TRUE); Length := STRLEN(CreditCardNo); FOR i := (Length - 1) DOWNTO 1 DO BEGIN Weight[i] := '2'; i := i - 1; IF i <> 0 THEN Weight[i] := '1'; END; FOR i := 1 TO (Length - 1) DO WeightString := WeightString + Weight[i]; CheckString := COPYSTR(CreditCardNo,1,(Length - 1)); CheckNumber :=STRCHECKSUM(CheckString,WeightString,10); IF EVALUATE(CheckDigit,COPYSTR(CreditCardNo,Length,1)) THEN IF CheckNumber = CheckDigit THEN EXIT(TRUE) ELSE EXIT(FALSE) ELSE EXIT(FALSE);

Hi Jane, I think your code is fine. I tried it with the following test numbers which I’ve found in the net: 4509472140549008 4111111111111111 5500000000000005 340000000000009 4907449927398716 If i calculate the check digit by hand I’ll have the same results. What result do you have if you calculate the valid credit card number by hand? regards, usto