explode
Summary
Splits the input string and returns it as an array of strings.
Usage
input|explode( separator )
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
| separator | string | Split sequence. | Yes. |
Returns
An array of strings.
Description
This operator takes a string as input and returns an array of strings. Each element in the array will be a part of the input string extracted on the basis of the specified sequence of split characters.
Examples
Example 1
{'All-your-base-are-belong-to-us!'|explode( '-' )}The following array will be returned: ( 'All', 'your', 'base', 'are', 'belong', 'to', 'us!' ).
Contributors
- Balazs Halasy Updated
- Pike Commenter
Comments (1 historical)
Written by readers of the earlier documentation sites, kept as they were.
need the pipe
pike ·
note, explode( input, separator ) does not work in 3.10.
only the pipe syntax works, as documented.