no edit summary
mNo edit summary |
No edit summary |
||
| Line 2: | Line 2: | ||
<!-- Describe the purpose of the function, exhausting detail can be saved for a later section --> | <!-- Describe the purpose of the function, exhausting detail can be saved for a later section --> | ||
Splits a string using a delimiter | Splits a string using a delimiter (optionally: into a specified number of pieces) | ||
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args --> | <!-- List return values and arguments as well as function name, follow Blizzard usage convention for args --> | ||
s1, s2, s3 ... sn = strsplit("delimiter", "subject") | s1, s2, s3 ... sn = strsplit("delimiter", "subject"[, pieces]) | ||
| Line 13: | Line 13: | ||
:;delimiter : String - Delimiter | :;delimiter : String - Delimiter | ||
:;subject : String - String to split | :;subject : String - String to split | ||
:;pieces : integer - Optional argument designating the number of pieces to make. | |||
| Line 21: | Line 22: | ||
== Example == | == Example == | ||
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory --> | <!-- If it helps, include an example here, though it's not required if the usage is self-explanatory --> | ||
local a, b, c = strsplit(" ", "a b c") | local a, b, c = strsplit(" ", "a b c d", 3) | ||
<big>'''Result'''</big> | <big>'''Result'''</big> | ||
| Line 27: | Line 28: | ||
a = "a" | a = "a" | ||
b = "b" | b = "b" | ||
c = "c" | c = "c d" | ||
== Details == | == Details == | ||