INSBYTES

The INSBYTES function inserts one or more bytes into a text expression.

When you are using a single-byte character set, you can use INSCHARS.

Return Value

TEXT

Syntax

INSBYTES(text-expression bytes [after])

Arguments

text-expression

A TEXT expression into which the bytes are to be inserted. When text-expression is a multiline TEXT value, INSBYTES preserves the line breaks in the returned value.

bytes

One or more bytes that you insert into text-expression.

after

An INTEGER that represents the byte position after which the specified bytes are to be inserted. The position of the first byte in text-expression is 1. To insert bytes at the beginning of the text, specify 0 for after. When you omit this argument, INSBYTES inserts the bytes after the last byte in text-expression.

When you specify a value for after that is greater than the length of text-expression, INSBYTES adds blanks to the last line of text-expression. The number of inserted blanks is the difference between the value of after and the length of text-expression. For example, insbytes('abc' 'def' 4) inserts one blank space before adding def to abc, resulting in.

abc def

Examples

Example 7-119 Inserting Bytes in Text

This example shows how to insert the bytes there in the TEXT value hellojoe.

The function

INSBYTES('hellojoe', 'there', 5)

returns the following value.

hellotherejoe