Split String

 

The Split String command provides additional power and flexibility to text string variable manipulation. It provides a quick method to break down a text string into smaller components and save each of the components to individual variable array elements.

 

 

Script Editor > Expand Variables Category > Split String

 

 

String to Split

Select the text string to be manipulated and saved to individual variable array elements.

 

 

Split String On

Input the value that separates the original text string. This value may be a <space>, a comma, a dash (-) or any other character or text string.

 

In the image above, all text up to the first ":" symbol in the T[1] string is saved to variable Sales[1]. The text after the first ":" symbol and up to the second ":" symbol is saved to variable Sales[2], and so on. The ":" symbol is not saved as part of the new variable.

 

Note: To split the string based on spaces in the string, place the cursor in this field and press the space bar once.

 

 

Place Resulting Strings in the Following Array

Select the variable array to store the individual components of the original text string.

 

 

Starting Index

Select which variable in the array is to receive the first record. Based on the image above, the first split is saved to variable Sales[1]. Array elements start with [1] and not [0].

 

 

Example

Below are a couple of examples that help illustrate this feature.

 

1. The text in the String to Split field is This is a test. The Split String On field is populated with a <Space>. The resulting string array is variable T, starting with Index 1. The values saved to variables T[1] through T[4] are shown below.

 

T[1] - This

T[2] - is

T[3] - a

T[4] - test

 

2. The text in the String to Split field is 801-927-5011. The Split String On field is populated with a dash (-). The resulting string array is variable T, starting with Index 5. The values saved to variables T[5] through T[7] are shown below.

 

T[5] - 801

T[6] - 927

T[7] - 5011