fenom/docs/en/mods/esplit.md
2014-08-02 00:24:14 +04:00

517 B

Modifier esplit

Split string by a regular expression. Read more about regular expression.

{$string|esplit:$pattern = '/,\s*/'}

My default modifier split string by comma with spaces.

{var $fruits1 = "banana, apple, pear"|esplit}
$fruits1 is array ["banana", "apple", "pear"]

{var $fruits2 = "banana; apple; pear"|esplit:'/;\s/'} is ["banana", "apple", "pear"]
$fruits2 is array ["banana", "apple", "pear"] too