Module:MW.text

-- This is just a helper library that implements some missing features from current Scribunto release

local common = require("Module:Common")

text = {}

function text.trim(val) return tostring(val):gsub("^%s*(.-)%s*$", "%1") end

function text.split(str, sep, lit) local pos = 1 local t = {} if not common.isset(sep) or not common.isset(str) then return t end for s, e in function return string.find(str, sep, pos) end do   t[#t+1] = text.trim(string.sub(str, pos, s-1)) pos = e+1 end t[#t+1] = text.trim(string.sub(str, pos)) return t end

return text