splitPart

Returns an element of a delimited string.

Example

Find and return the second element of the ’-’ delimited string “Apples-Oranges-Bananas”.

splitPart("Apples-Oranges-Bananas","-",2)

In this example, splitPart returns “Oranges”.

Syntax

splitPart(string delimited_string, string delimiters, int index)
  • delimited_string: delimited string to search
  • delimiters: string representing the delimiters
  • index: index int of the element to return

    Returns

    string

Description

This function parses delimited_string in segments by delimiters. It returns the segment indicated by index. The first segment, before the first delimiter is segment 1. Note that the word before a delimiter corresponds to a index value “1” and the one after corresponds to a index value “2”. If the same delimiter is repeated after the second word, then the following word corresponds to a index value “3”. If the delimiter is different, then this delimiter is surrounded by a word corresponding to a index value “1” (before) and a index value “2” after.

© Incorta, Inc. All Rights Reserved.