Sfairadora

  • Reference Guide

replace

replace(str1, pos, str2)
var_str <- replace(pos, str2)
The first variant replaces the characters in the string str1 at the position pos with the string str2. The altered string is returned as the result. The str1 parameter remains unchanged. The latter variant replaces the characters in the variable (or data item) var_str at the position pos with the string str2 (i.e. it changes the content of the variable in place).
If the position pos is negative or beyond the end of the string, an error is returned.

Parameters

str1
A value of the type Binary, String, Text or Rich_string.
var_str
A variable of the type Binary, String, Text or Rich_string.
pos
The position at which are the characters to be replaced (the type Int). The value 0 denotes the beginning of the string.
str2
The string to be used for replacement (the type Char or String). If str1 is a Text, it can also be a Text. If str1 is a Rich_string, it can also be a Rich_string. If str1 is Binary, str2 must be either Byte or Binary.

Return Value

The first variant returns the altered string. It is of the same type as str1.
The latter variant returns an l-value denoting the variable var_str.

See Also