1/5

split(): cut a line into fields

Easy

Cut ri!line wherever ri!separator appears and return the pieces.

Remember that a separator which never appears still gives you a list, and that empty text is not an empty list.

Inputs

  • ri!line — Text
  • ri!separator — Text

ri! Rule Inputs

ri!lineText
"a,b,c"
ri!separatorText
","

Example 1 — Commas

Input: ri!line
"a,b,c"
Input: ri!separator
","
Output:
{
  "a",
  "b",
  "c"
}

Example 2 — A different separator

Input: ri!line
"a-b"
Input: ri!separator
"-"
Output:
{
  "a",
  "b"
}

Example 3 — Separator never appears

Input: ri!line
"abc"
Input: ri!separator
","
Output:
{"abc"}

Example 4 — A separator longer than one character

Input: ri!line
"a, b, c"
Input: ri!separator
", "
Output:
{
  "a",
  "b",
  "c"
}

Example 5 — Empty text still yields one empty piece

Input: ri!line
""
Input: ri!separator
","
Output:
{""}

Appian Expression Tips

  • • Use ri!variableName for rule inputs
  • • Use a!localVariables(local!x: …, body) for locals
  • • Use a!forEach(items: …, expression: fv!item) to iterate
  • • Use where() / reject(fn!isnull, list) to filter