XenoGuard Documentation

Insert

Actions » Programming » String Operation » Addendum » Insert 

The action Insert places a single character or sequence of characters on a specified position in a string and stores the new string in Result of the result list.

[-] Hide
  1. Open the Programming node in the Workspace Explorer.
  2. Open the String Operation node.
  3. In the Addendum node, select the Insert action.

Parameters:

The action has the following input parameters:


name Description
String The string to be modified.

Allowed Context Scopes [Fixed, Local, Global]
Allowed Context Types [Variable, Parameter, Enum]
Insert String
The string to be inserted.

Allowed Context Scopes
[Fixed, Local, Global]
Allowed Context Types [Variable, Parameter, Enum]
Insert Index
Specifies the position where the Insert String parameter is to be placed.

Allowed Context Scopes
[Fixed, Local, Global]
Allowed Context Types [Variable, Parameter, Enum]

Results:

The action returns the following results:


name
description
Result Contains the new string.

Allowed Context Scopes [Fixed, Local, Global]
Allowed Context Types [Variable, Parameter]

Warning An exception occurs when the value of the Insert Index parameter is set to a negative number or greater than the length of the String parameter.

Example 1 (Adds a text between the string of a variable):

This example inserts a text to the local String 1 variable with Text as data type. The text is inserted in the 4th index position of the String 1 variable. The Result of the new string is then output via Speech Output.

Example 2 (Adds whitespace within the string of a variable):

This example inserts whitespace to the local String 1 variable with Text as data type. The whitespace is inserted in the 8th index position of the string. The Result of the new string is then output via Write Text.

Example 3 (Inserts a currency symbol to a variable):

This example inserts a currency symbol from a local currentSymbol variable to the local price variable with Text as data type. The currency symbol is inserted in the 1st index position of the string. The Result of the new string is then output via Message Box.

See other Addendum operations:

Concatenate
Replace
Pad Left
Pad Right