split
  • Dark
    Light
  • PDF

split

  • Dark
    Light
  • PDF

split Task Purpose

The split task is used to split a string into an array of substrings using a given separator or point where the split should take place. Once the split is executed, the result is a new array containing the split values. The original string is not changed.

Potential Use Case

A comma separated list of ticket numbers is provided to the automation. Using the split task, you are able to create an array of the ticket numbers for subsequent processing in the workflow.

Parameters

Input and output parameters are shown below.

Input Type Description
str String Required. The string to split.
separator String Specifies the point where each split should occur. The separator can be a single character or multiple characters. If the separator is omitted then the entire string becomes one single array element. If the separator is an empty string (“”) then every character of the string is separated.
limit Number Specifies the number of splits in a given string; items after the split limit are not included in the returned array. The limit parameter can be zero or a non-negative integer.


Output Type Description
splitArray Array An array of strings formed after splitting the given string at each point where the separator occurs.

Examples

In the IAP example shown below:

  • The incoming str variable is required.

    splitString-01

  • The variables are set prior to running the workflow. In the example below, the string is "Hello World". The letter "o" is the separator and the limit is set to "3".

    splitString-02

  • Once the workflow is executed, you can view the output in Task History, which is accessed from Jobs in Operations Manager. In the example, three (3) splits were made to the original input string, at each instance of the letter "o". Of note, split also looks for and includes white-space.

    splitString-03


What's Next