Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 1
Syntax
Code Block
languagenone
set splittedStringArray = aString.split(regExpPattern)
set splittedStringArray = split(LITERAL, regExpPattern)
SemanticsReturns an array of strings. Wherever the pattern matches
,
the string will be split. The string fragments are stored in the array splittedStringArray. The state of the current string is not changed.
InfoiconfalsetitleNote the following behavior of regular expressions:

If pattern expression regExpPattern contains capturing parentheses, the captured data will also be saved in the destination array, together with the fields themselves (see also the examples below and the ICU User Guide > Regular Expressions > Using split()).

SubstitutablesaString Can be any variable or object attribute having the type String.  
regExpPattern Regular expression (see Regular Expressions for a list of valid regular expressions). An introduction into regular expressions can be found at http://www.regular-expressions.info/.
LITERAL String literal.
Examples
Code Block
languagenone
set splittedStringArray = stringSet.s1.split("\S+
");

Assume we have a string containing a list of customers:

VariableValue
string"Spring Corp., Summer Ltd.; Autumn & Co., Winter & Partners"
Assuming that the split character is either the "," or the ";
"
, you can split this string with the following results:Regular ExpressionResult splittedStringArray set splittedStringArray = string.split(",|;"
);
["Spring Corp.", "Summer Ltd.", "Autumn & Co.", "Winter & Partners"] set splittedStringArray = string.split("(,|;)");["Spring Corp.", "Summer Ltd.", "Autumn & Co.", "Winter & Partners", ",", ";"]