Module:Split

local libraryUtil = require( 'libraryUtil' )

return function (str, pattern) assert(str and pattern, 'split: Missing arguments') libraryUtil.checkType( 'split', 1, str, 'string' ) libraryUtil.checkType( 'split', 2, pattern, 'string' ) local i, out = 1, {} local split_start, split_end = string.find(str, pattern, i) while split_start do    out[#out + 1] = string.sub(str, i, split_start - 1) i = split_end + 1 split_start, split_end = string.find(str, pattern, i) end out[#out + 1] = string.sub(str, i) return out end