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.
Return value
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
See also
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
