string.split(str, separator)

Splits a string into substrings by a separator.

Parameters

str

The string that will be divided into substrings.

separator

A string that will be used as a separator to divide the string into substrings.

This function can split ASCII or UTF8 encoded strings.

Return value

Returns a list of substrings as a table.

Example

-- Lua string.split example local console = require "console" local str = "Hello[space]World[space]by[space]LuaRT[space]!" for word in each(str:split("[space]")) do console.write(word.." ") end