[Table of Contents] [docx version]

SpreadsheetML Reference Material - Table of Contents

REPLACEB

Syntax:

REPLACEB ( string-1 , start-pos , number-bytes , string-2 )

Description: Produces a new string that is string-1 with number-bytes bytes starting at position start-pos, replaced by string-2. (REPLACEB is intended for use with languages that use the double-byte character set (DBCS), whereas REPLACE3.17.7.269) is intended for use with languages that use the single-byte character set (SBCS).)

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- bytes 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- bytes

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-bytes < 0, #VALUE! is returned.

[Example: Assuming 1-byte characters:

REPLACEB("abcdefghijk",3,4,"XY") results in abXYghijk
REPLACEB("abcdefghijk",3,1,"12345") results in ab12345defghijk
REPLACEB("abcdefghijk",15,4,"XY") results in abcdefghijkXY

end example]