The StringPart()
function splits a text into an array of text values, and returns the part at a specified position.
Syntax
StringPart(text, separator, position)
Returns
The part at a position in an array of text values split at each point where the separator occurs in the given text
Parameters
text
– The text to splitseparator
– Specifies the character(s) to use for separating the textposition
– The position of the part to return
Examples
StringPart("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", ",", 3)
/* Returns "Mar" */
StringPart("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", ",", 0)
/* Returns unknown text */
StringPart("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", ",", 15)
/* Returns unknown text */
StringPart("The quick brown fox jumps over the lazy dog.", " ", 1)
/* Returns "The" */
StringPart("The Answer to the Ultimate Question of Life, The Universe, and Everything.", "The", 2)
/* Returns " Universe, and Everything." */