Documentation
Back to website >

EAN13 (Pascalscript)

Description

EAN13 forms the check digit for an EAN13 bar code.

Syntax

function EAN13(const S: String): Integer;

Arguments

The string S with a 12 or 13 character long barcode number is passed as argument. The EAN check digit 0-9 is supplied as the result.

Example

var
  S1: String;
  i: Integer;
  S2: String;
begin
  S1:='659556182335';
  i:=EAN13(S1);
  S2:=IntToStr(i);
  ShowMessage(S2);
end;

Rules to understand the script can be found here.

The text '659556182335' is assigned to the string variable S1. Function EAN13 forms the check digit and assigns it to variable i. IntToStr converts the integer value i into a displayable text S2.

The check digit function processes strings with and without check digits.

ShowMessage shows: 8