For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Open sourceSupportFAQsDocs Home
DocumentationAPI referenceRelease notes
DocumentationAPI referenceRelease notes
  • Platform On-Prem
    • Overview
    • Navigate
    • Search resources
  • Apps
      • Overview
      • Navigate
        • Configure and manage tasks
        • Null vs. undefined values
        • Parallel branches
          • Overview
          • addDuration
          • arrayIncludes
          • arrayLastIndexOf
          • arrayPop
          • arrayToString
          • assign
          • calculateTimeDiff
          • charAt
          • charCodeAt
          • childjob
          • codePointAt
          • concat
          • concatArray
          • convertEpochToObject
          • convertTimeFormat
          • convertTimeToEpoch
          • convertTimezone
          • copyWithin
          • csvStringToJSON
          • deepmerge
          • delay
          • endsWith
          • ErrorHandling
          • evaluation
          • eventListenerJob
          • excelToJson
          • extractField
          • fill
          • FlattenJSONFormInput
          • getTime
          • includes
          • arrayIndexOf
          • indexOf
          • isArray
          • join
          • keys
          • lastIndexOf
          • length
          • length (string)
          • localeCompare
          • makeData
          • map
          • match
          • merge
          • modify
          • newVariable
          • normalize
          • objectHasOwnProperty
          • objectToString
          • padEnd
          • padStart
          • parse
          • parseInt
          • pop
          • push
          • pushToArray
          • query
          • repeat
          • restCall
          • reverse
          • runCode
          • search
          • setObjectKey
          • shift
          • slice (array)
          • slice (string)
          • sort
          • split
          • startsWith
          • stringValueOf
          • stub
          • substring
          • toLocaleLowerCase
          • toLocaleString
          • toLocaleUpperCase
          • toLowerCase
          • numberToString
          • toString (array)
          • toString (number)
          • toString (object)
          • toUpperCase
          • transformation
          • trim
          • trimEnd
          • trimStart
          • unshift
          • updateJobDescription
          • values
          • viewData
    • FlowAI
    • Itential Automation Gateway
  • Resources
    • Itential Academy
    • Version lifecycle
    • Itential MCP
    • Accessibility conformance
    • Get support
    • FAQs
LogoLogo
Open sourceSupportFAQsDocs Home
On this page
  • Task purpose
  • Potential use case
  • Properties
  • Examples
  • Example 1
  • Example 2
  • Related reading
AppsStudioTasksTask reference

slice (string)

Was this page helpful?
Previous

sort

Next
Built with

Task purpose

Similar to the substring task, the slice (string) task extracts part of a string and returns the extracted part in a new string. The part to extract is specified by start and end indexes, or extends to the end of the string if no end index is provided.

Potential use case

Use this task when you need to extract a specific portion of a string — for example, extracting only the telephone area code from an incoming phone number string.

Properties

IncomingTypeDescription
strStringRequired. The string containing the value to extract.
beginIndexNumberRequired. The position at which to begin extraction. The first character is at position 0. Defaults to 0.
endIndexNumberOptional. The position at which to stop extraction. Extraction proceeds up to, but not including, this position.

If endIndex is less than beginIndex, slicedString returns an empty string (""). If this is not the desired behavior, consider using the substring task instead.

OutgoingTypeDescription
slicedStringStringThe portion of str between beginIndex and endIndex.

Examples

Example 1

In this example:

  • str is statically set to 800-555-1212.
  • beginIndex is 7 — extraction begins at the second dash.
  • endIndex is 4 — extraction would stop before character 4 (the first "5").
  • Because beginIndex is greater than endIndex, slicedString returns "" (an empty string).
slice (string) example 1 — configuration
slice (string) example 1 — incoming variables
slice (string) example 1 — empty string output

Example 2

In this example:

  • str is statically set to 800-555-1212.
  • beginIndex is 4 — extraction begins at the first "5".
  • endIndex is 7 — extraction stops before character 7 (the second "-").
  • slicedString returns 555.
slice (string) example 2 — configuration
slice (string) example 2 — incoming variables
slice (string) example 2 — output

Related reading

  • slice (string) API reference