GetChar Function

Action

Retrieves a one-byte signed character (ASCII number) from a specified data structure at a specified position. You must declare a BDL string before using this function. Use the chr function to convert the retrieved ASCII number to a character.

Include file

Kernel.bdh

Syntax

GetChar( in sString : string, in nPos  : number ): number;

Return value

signed character (ASCII number)

Parameter Description
sString BDL string corresponding to the data structure
nPos Position of character in the BDL string, where the first position is 1 (not 0)

Example

dcltrans
  transaction TGetChar
  const
    SIZE_STRUCT := 32;
  var
    myBDLstring : string(SIZE_STRUCT);
    nChar       : number;
  begin
    ...
    // Retrieve a one-byte signed character from position 1
    // in the BDL string myBDLstring and thereby (through mapping) 
get
    // the element myChar in Struct1
    nChar := GetChar(myBDLstring, 1);
    write("myChar = "); write(chr(nChar)); writeln;
  end TGetChar;

Output

myChar = A