Module:Split

local checkType = require( 'libraryUtil' ).checkType

return function ( str, pattern, plain ) checkType( 'split', 1, str, 'string' ) checkType( 'split', 2, pattern, 'string' ) checkType( 'split', 3, plain, 'boolean', true ) local i, out = 1, {} local split_start, split_end = string.find( str, pattern, i, ( plain or false ) ) 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, ( plain or false ) ) end out[#out + 1] = string.sub( str, i )

return out end