REPLACE
Syntax:
REPLACE ( string-1 , start-pos , number-chars , string-2 )
Description: Produces a new string that is string-1 with number-chars characters starting at position start-pos, replaced by string-2. (REPLACE
is intended for use with languages that use the single-byte character set (SBCS), whereas REPLACEB
(§3.17.7.270) is intended for use with languages that use the double-byte character set (DBCS).)
Arguments:
Name |
Type |
Description |
---|---|---|
string-1 |
text |
Designates a string. |
start-pos |
number |
The number of the start position within string-1 from which characters in string-1 are to be replaced. The start position of the first character is 1. start-pos shall be at least 0. If start-pos is beyond the end of string-1, the result is a new string that is string-2 appended to string-1. If start-pos is within the bounds of string-1, but number-chars goes beyond the end of string-1, the characters starting at position start-pos through to the end of string-1 shall be replaced by string-2. |
number-chars |
number |
The number of characters within string-1 that are to be replaced by the string designated by string-2. |
string-2 |
text |
Designates a string. |
Return Type and Value: text – A copy of string-1 with replacement characters from string-2.
However, if
start-pos < 0,
#VALUE!
is returned.number-chars < 0,
#VALUE!
is returned.