Guidance
指路人
g.yi.org
software / rapidq / Examples / Graphics & Animation / barcode / barcode / 2of5 / 2OF5.INC

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
     DECLARE FUNCTION CODE2OF5(tekst AS STRING) AS STRING


     FUNCTION CODE2OF5(tekst AS STRING) AS STRING
'
'
'   -----------------------------------------------------------
'   inizialize VAR`S
'
      DIM bcode(0 TO 13) AS STRING*14  ' ARRAY with bitpatterns STRING`S
      DIM BITMAP AS STRING             ' 0/1 white/black 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
'   -----------------------------------------------------------
'
'   TABEL from  http://www.barcodeisland.com
      BCode(0) = "10101110111010" '00
      BCode(1) = "11101010101110" '01
      BCode(2) = "10111010101110" '02
      BCode(3) = "11101110101010" '03
      BCode(4) = "10101110101110" '04
      BCode(5) = "11101011101010" '05
      BCode(6) = "10111011101010" '06
      BCode(7) = "10101011101110" '07
      BCode(8) = "11101010111010" '08
      BCode(9) = "10111010111010" '09
'
'   --------------------------------------------------------------
' CALCULATE CHECKSUM
      WEIGHT=3

      LANG=LEN(TEKST)
      FOR X= 1 TO LANG

       CHK=X*WEIGHT
       CHECK=CHECK +CHK

       SELECT CASE WEIGHT ' flips WEIGHT FROM 3 TO 1 TO 3 TO 1 ECT
       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


'   make 0/1 string for later bitmap conversion

      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
'-----------------------------------------------------------------














掌柜推荐
 
 
¥1,290.00 ·
 
 
¥918.00 ·
 
 
¥890.00 ·
 
 
¥294.00 ·
 
 
¥430.00 ·
 
 
¥1,380.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2001-05-25 19:47:12