Documentation
Back to website >

EAN8 (Pascalscript)

Description

EAN8 forms the check digit for an EAN8 bar code.

Syntax

function EAN8(const S: String): Integer;

Arguments

The string S with a 7 or 8 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:='4711081';
  i:=EAN8(S1);
  S2:=IntToStr(i);
  ShowMessage(S2);
end;

Rules to understand the script can be found here.

Text'4711081' is assigned to string variable S1. The check digit is formed using function EAN8 and assigned 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: 6