Module:HF

local HF = {}

function HF.explode( sep, text ) local sep, fields = sep or "::", {} local pattern = string.format("([^%s]+)", sep) text:gsub(pattern, function(c) fields[#fields+1] = c end) return fields end

function HF.trim(s) if s ~= nil then return (s:gsub("^%s*(.-)%s*$", "%1")) else return nil end end

function HF.isempty(s) return s == nil or s == "" end

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

function HF.round(num, idp) local mult = 10^(idp or 0) return math.floor(num * mult + 0.5) / mult end

return HF