DECLARE FUNCTION CODE2OF5(tekst AS STRING) AS STRING
FUNCTION CODE2OF5(tekst AS STRING) AS STRING
DIM bcode(0 TO 13) AS STRING*14
DIM BITMAP AS STRING
DIM TEKSTX AS STRING
DIM x AS INTEGER
DIM barlengte AS INTEGER
DIM LANG AS INTEGER
DIM WEIGHT AS INTEGER
DIM CHK AS INTEGER
DIM CHECK AS INTEGER
BCode(0) = "10101110111010"
BCode(1) = "11101010101110"
BCode(2) = "10111010101110"
BCode(3) = "11101110101010"
BCode(4) = "10101110101110"
BCode(5) = "11101011101010"
BCode(6) = "10111011101010"
BCode(7) = "10101011101110"
BCode(8) = "11101010111010"
BCode(9) = "10111010111010"
WEIGHT=3
LANG=LEN(TEKST)
FOR X= 1 TO LANG
CHK=X*WEIGHT
CHECK=CHECK +CHK
SELECT CASE WEIGHT
CASE 3
WEIGHT=1
CASE 1
WEIGHT=3
END SELECT
NEXT X
CHECK=CHECK MOD 10
IF CHECK>0 THEN
CHECK=10-CHECK
END IF
CHK=CHECK+48
TEKSTX = TEKST +CHR$(CHK)
barlengte=LEN(tekstX)
FOR x = 1 TO barlengte
barchar=ASC(MID$(tekstX,x,1))-48
BITMAP=BITMAP+BCODE(BARCHAR)
NEXT x
CODE2OF5="11011010"+BITMAP+"1101011"
END FUNCTION
|