str:split()
splits a string using a pattern string to determine where the splits should occur, returning a node-set containing the resulting strings.
Syntax
str:split(string, pattern)
Parameters
string
- The string to split.
pattern
- The pattern indicating where to split the string.
Returns
A node-set of token
elements, each containing one token from the string
.
Example
str:split('book, phone, computer, chair', ', ')
Returns a node set like:
<token>book</token> <token>phone</token> <token>computer</token> <token>chair</token>
Specifications
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
str:split() | Chrome ? | Edge ? | Firefox Full support 3 | IE ? | Opera ? | Safari ? | WebView Android ? | Chrome Android ? | Firefox Android Full support 4 | Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown