replaceSubStr()

The strLib.replaceSubStr() system function searches for a specified character and returns a new string where the specified character(s) are replaced.

Syntax

   strLib.replaceSubStr(
             target STRING | CHAR | DBCHAR | MBCHAR | UNICODE In, 
             toReplace STRING | CHAR | DBCHAR | MBCHAR | UNICODE In)
             replacement STRING | CHAR | DBCHAR | MBCHAR | UNICODE In) 
  returns (result STRING | CHAR | DBCHAR | MBCHAR | UNICODE))
target

Input can be any value that is assignment compatible with any of the above types.

toReplace

Input can be any value that is assignment compatible with any of the above types.

replacement

Input can be any value that is assignment compatible with any of the above types.

result

It returns a new string composed of the target string where all the occurrences of toReplace are replaced with the replacement.

Example

  function main()
           myStr String = “Customer department service”;

           sysLib.writeStdout(“Replaced string is: “+ strLib.replaceSubStr (myStr, “department”, “support”));
  end

The output is as follows:

    Replaced string is: Customer support service