Files
fusionpbx/resources/install/scripts/resources/functions/explode.lua
mafoo b7555579bf WhitespaceClean-resources/install/scripts
whitespace pass over files
for reference regex that was used s/[ \t]+(\r?\n)/\1/
2016-03-11 13:21:52 +00:00

13 lines
510 B
Lua

--add the explode function
function explode ( seperator, str )
local pos, arr = 0, {}
if (seperator ~= nil and str ~= nil) then
for st, sp in function() return string.find( str, seperator, pos, true ) end do -- for each divider found
table.insert( arr, string.sub( str, pos, st-1 ) ) -- attach chars left of current divider
pos = sp + 1 -- jump past current divider
end
table.insert( arr, string.sub( str, pos ) ) -- attach chars right of last divider
end
return arr
end