Element: blob.replace ( )

Syntax

<ident> = <blob>.replace(<range>, <blob2>)

   or

<blob>.replace(<range>, <blob2>)

Type

blob or procedure

Description

A function which replaces part of one blob with the contents of another blob.

If called as part of a blob assignment or expression, the return value of this function is the merge of the blob with a byte range replaced by another blob (parameter blob2). The original blob is left unchanged.

If called stand-alone, there is no return value but the blob has the contents of blob2 inserted into it replacing a specified byte range.

This function has 2 parameters: range, a byte range in the form startbyte:endbyte or just byte if only one byte is being replaced, and blob2, a blob expression yielding the blob to be inserted.

The code of this function cannot be redefined.

Examples

Insert one blob into another, replacing bytes 100 through 149:

myblob.replace(100:149,yourblob)

Merge 2 blobs, returning the result into a 3rd blob:

blob newblob = myblob.replace(100:149,yourblob)

See Also

Commands:

blob

Structures:

blob, blob.append, blob.insert, blob.part