Strlen Function

Action

Retrieves the length of a string.

In contrast to the Binlen function Strlen does not return the data length, but returns the number of characters before the first '\0' (null) character.

Include file

Kernel.bdh

Syntax

Strlen( in sString : string ): number;

Return value

string length

Parameter Description
sString Input string

Example

dcltrans
  transaction TStrlen
  var
    sString : string;
    nLength : number;
  begin
    sString := "Hello world!";
    write("string = "); write(sString); writeln;
    nLength := Strlen(sString);
    write("length = "); write(nLength); writeln;
    write("length of long string = ");
    write(Strlen("This is quite a long string")); writeln;
  end TStrlen;

Output

string = Hello world!
length = 12
length of long string = 27

Sample scripts

WebFileUpload01.bdf