SetString Function


Copies a string at a specified position into a string.

Note: This function can be used to access pointers.

Include file



SetString( inout sDest     : string,
           in    nPosition : number,
           in    sSource   : string,
           in    nMaxLen   : number optional,
           in    sFillChar : string optional ):boolean;

Return value

  • true if successful

  • false if string to copy terminated or failure

Parameter Description
sDest Identifies the destination string
nPosition Specifies the position to copy to in aSrcString, where the first position in a string is 1 (not 0)
sSource Identifies the string to copy
nMaxLen Maximum number of characters to copy (optional). If this parameter is omitted, the whole source string is copied to the destination string
sFillChar Specifies a character sequence used to fill the remaining bytes if the copied string is shorter than nMaxLen (optional). If this parameter is passed to the function, no NULL termination is inserted into the destination string
Note: If the length of sSource is larger than nMaxLen, only nMaxLen bytes are copied to sDest, including a NULL termination byte. If the optional parameter sFillChar is passed to the function, then no NULL termination is inserted into sDest.


  transaction TSetString
    SIZE_STRUCT := 32;
    myBDLstring    : string(SIZE_STRUCT);
    sString, sDest : string;
    // Copy a string from sString into myBDLstring starting
    // at position 22 and thereby (through mapping)set
    // the element myString in Struct1
    sString := "Holidays";
    SetString(myBDLstring, 22, sString);
    SetString(sDest, 1, sString, 20, "_");
  end TSetString;