Insert

Use this function to insert a substring into a string at the position you specify. The result string is returned.

Syntax

Insert (String, Position, SubString)

Parameter

Description

String

Enter a valid string. The default is the value of the current field.

Position

Enter the position in the field to perform the insert. The default is the one (1), the first position.

SubString

Enter the string that you want to insert.

The system adds the substring to the string you specified in the first parameter at the indicated position. If the position indicated in the second parameter is greater than the length of the original string, the string is increased to the given length before the third parameter is inserted.

If no position is given in the second parameter the insertion begins at position one. If no value is provided for the third parameter (Substring), nothing is inserted.

Example

Here are some examples:

(Assume the current field contains the text Your Name.)

Function

Result

Explanation

Return(Insert ( , , "Type "))

Type Your Name

Defaults to the first position of the current field and inserts Type.

Return(Insert ( , CFIND ( , " "), " First"))

Your First Name

First the CFind function locates a blank space at position 5 within Your Name. Next, First is inserted at position 5.

Return(Insert ("Complete blank.", 10, "every "))

Complete every blank.

Goes to position 10 and inserts every.

Return(Insert ("Complete blanks", 17, "with black ink."))

Complete blanks with black ink.

Increases the length of the field to 17 and appends with black ink.

See also