Strnset Function

Action

Overwrites the beginning of a string with nCount characters.

Include file

Kernel.bdh

Syntax

Strnset( inout sString    : string,
         in    nCharacter : number,
         in    nCount     : number ): string;

Return value

the altered string

Parameter Description
sString String to be overwritten. This parameter will contain the altered string after the Strnset operation
nCharacter Defines a character that the function uses to overwrite a section of sString
nCount Defines the number of characters to overwrite in sString

Example

dcltrans
  transaction TStrnset
  var
    sString, sResult : string;
    nChar : number;
  begin
    sString := "Hello world!";
    nChar := ord('*');
    write("string = "); write(sString); writeln;
    write("char   = "); write(chr(nChar)); writeln;

    sResult := Strnset(sString, nChar, 5);
    write("result = "); write(sResult); writeln;
  end TStrnset;

Output

string = Hello world!
char   = *
result = ***** world!