====== SplitToArray ======
The SplitToArray function splits a string according to a list of separators and returns a structure that allows iteration in the RuleSet.
==== Syntax: ====
SplitToArray ('string','separator/string', boolean, boolean,)
Parameters:
- String which is to be split.
- Separator or string which triggers the split.
- Remove empty values: **true**((default Value))/false
- Trim values: **true**((default Value))/false
- Separator is a string: true/**false**((default Value)), if this optional parameter is used then the second parameter can be specified as a string and triggers the split point(s).
===== Example: =====
Following returns five structure entries with index 0 - 4 and the values.
SplitToArray("Paul;Mustermann;street 22;99999,city", ";,")
The next one results in value: "street 22"
SplitToArray("Paul;Mustermann;Street 22;99999,City", ";,")/Items[@Index = 2]/@Value
Without specification of the third parameter, empty values are removed, so the next statement returns the value: "99999".
SplitToArray("Paul;; Street 22,,;99999,City", ";,")/Items[@Index = 2]/@Value
The following delivers: 4
count(SplitToArray("Paul;; Street 22,,;99999,City", ";,")/Items)
Without removing blank values and without trim, by setting parameters three and four to false, the next example returns the value: " Street 22".
SplitToArray("Paul;; Street 22,,;99999,City", ";,", false, false)/Items[@Index = 2]/@Value
**Use a string as a separator:** @Rg_Betreff = "Test Erechnung
Zeile 2"
SplitToArray( @Rg_Subject, '
', true(), true() )
{{:images:sign_warning.png?nolink|}} Note: [[en:howtos:buildhierarchwithsplittoarray|]]