getStringTokens

creates an array with tokens from a given string

Syntax

getStringTokens

Returns

returns (array) with string tokens

Parameters

stringToTokenise (string)
the string to tokenise
breakCharacters (string)
(optional) a string of characters, any of which will be considered to be a token delimiter. Or "," a comma if empty
quoteCharacters (string)
(optional) if this string isn't empty, it defines a set of characters which are treated as quotes. Any text occurring between quotes is not broken up into tokens.

Usage

example:

echo(objectToString(getStringTokens("a,b,c")));
echo(objectToString(getStringTokens("a-b-c", "-")));
echo(objectToString(getStringTokens("'a'-'b'-'c-d'", "-", "'")));

output:

[
  "a",
  "b",
  "c"
]
[
  "a",
  "b",
  "c"
]
[
  "'a'",
  "'b'",
  "'c-d'"
]