Skip to main content
Version: 7.9

substring

This function is used by Ignition's Expression language.

Description

Substring will return the portion of the string from the startIndex to the endIndex, or end of the string if endIndex is not specified. All indexes start at 0, so in the string "Test", "s" is at index 2. Indexes outside of the range of the string throw a StringIndexOutOfBoundsException.

Syntax

substring(string, startIndex[, endIndex])

  • Parameters

    • string string - The starting string.

    • integer startIndex - The index to start the substring at.

    • integer endIndex - Optional. The end index of the substring.

  • Results

    • string - The substring from the start to end indexes of the specified string.

Examples

Code Snippet
substring("unhappy", 2) //returns "happy"
Code Snippet
substring("hamburger", 4, 8) //returns "urge"