split

Split a text by a delimiter

Parameters description

ParameterTypeDescriptionDefault

text

string

the text to split

---

delimiter

string

the delimiter between the different texts in the main text

---

returnAllAs

'string'|'number'?

if the main text contains any numbers, you can choose for these values to be returned as number or the default string

'string'

isArray

boolean?

choose to return all the values as an array in one value or not

false

Example

local texts = HRLib.string.split('test1|test2|test3', '|', nil, true)
print(texts[1], texts[2], texts[3]) -- Output: test1 test2 test3

Last updated