Module:UtilsString

local p = {}

function p.CapitalizeFirstLetter(str) return (str:gsub("^%l", string.upper)) end

function p.isEmpty(str) return str == nil or str == "" end

function p.startsWith(pattern, str) return str:sub(1, #pattern) == pattern end

function p.endsWith(pattern, str) return str.match(str, pattern, #str - #pattern + 1) == pattern end

-- By http://lua-users.org/wiki/RiciLake -- See http://lua-users.org/wiki/StringInterpolation function p.interpolate(s, tab) return (s:gsub('($%b{})', function(w) return tab[w:sub(3, -2)] or w end)) end

return p