Function (StringVar input) NumberVar checkDigitSubtotal; NumberVar i; StringVar checkDigit; StringVar temp;
Select Len(input) Case 12 : input := Left(input, 11) Case 14 : input := Mid(input, 3, 11); Select input[1] Case "0" : temp := "U|xa" Case "1" : temp := "[|xb" Case "2" : temp := "V|xc" Case "3" : temp := "W|xd" Case "4" : temp := "X|xe" Case "5" : temp := "Y|xf" Case "6" : temp := "Z|xg" Case "7" : temp := "u|xh" Case "8" : temp := "\|xi" Case "9" : temp := "]|xj";
For i := 2 To 6 Do ( temp := temp + Chr(65 + Val(input[i])) ); checkDigitSubtotal := Val(input[1]) + Val(input[3]) + Val(input[5]) + Val(input[7]) + Val(input[9]) + Val(Right(input, 1)); checkDigitSubtotal := (3 * checkDigitSubtotal) + Val(input[2]) + Val(input[4]) + Val(input[6]) + Val(input[8]) + Val(input[10]); checkDigit := Right(ToText(300 - checkDigitSubtotal,"#"), 1); temp := temp + "y" + Right(input, 5) + Chr(107 + (Val(checkDigit))) + "z"; Select checkDigit Case "0" : temp + "U" Case "1" : temp + "[" Case "2" : temp + "V" Case "3" : temp + "W" Case "4" : temp + "X" Case "5" : temp + "Y" Case "6" : temp + "Z" Case "7" : temp + "u" Case "8" : temp + "\" Case "9" : temp + "]" |