Strcat Function

Action

Appends a string sAppend to another string.

Include file

Kernel.bdh

Syntax

Strcat( inout sString : string,
        in    sAppend : string ): string;

Return value

concatenated string

Parameter Description
sString Source string. This parameter will contain the concatenated string after the Strcat operation
sAppend String to append
注: The use of this function has been expanded. It is possible to pass to the function either a string or a pointer to a buffer (in the latter case the keyword in has to be used).

Example

dcltrans
  transaction TStrcat
  var
    sString1, sString2 : string(100);
    sOutput1, sOutput2 : string(100);
    nBuffer1, nBuffer2 : number;
  begin
    nBuffer1 := Malloc(100); nBuffer2 := Malloc(100);
    sString1 := "Hello "; sString2 := "world!";

    // copy sString1 to output string and append sString2
    Strcpy(sOutput1, sString1); Strcat(sOutput1, sString2);

    // copy strings to buffers and concatenate them
    Strcpy(in nBuffer1, sString1); Strcpy(in nBuffer2, sString2);
    Strcat(in nBuffer1, in nBuffer2);
    Strcpy(sOutput2, in nBuffer1);

    write(sOutput1); writeln;
    write(sOutput2); writeln;
    Free(nBuffer1); Free(nBuffer2);
  end TStrcat;

Output

Hello world!
Hello world!