Module:ProcessingFunctions

From Heterodontosaurus Balls

Documentation for this module may be created at Module:ProcessingFunctions/doc

local Functions = {} 

function Functions.stringToArray(delimiter)
	return function(str)
		if str == nil then return nil end
		
		local array = mw.text.split(str, delimiter)
		for i=1, #array do
			array[i] = mw.text.trim(array[i])
		end
		
		return array
	end
end

function Functions.stringToBoolOrNil(str)
	local Yesno = require('Module:Yesno')

	return Yesno(str, nil)
end

function Functions.stringToNumber(str)
	return tonumber(str)
end

return Functions