Piznium random utilities/Using arithmetic operators on strings/Test code

function mysplit (inputstr, sep) if sep == nil then sep = "%s" end local t={} for str in string.gmatch(inputstr, "([^"..sep.."]+)") do               table.insert(t, str) end return t end

function displayTable(table,tables) print("\nTable \"" .. tables .. "\" includes:") for i in pairs(table) do   print("Item " .. i .. ": " .. table[i]) end print("") end

function arithOnString(method,first,second) local got = "" if method == "+" then print("Concatenation of strings using + is currently not available.") elseif method == "-" then got = string.gsub(first,second,"") -- Replace string.gsub with replace once added into full release elseif method == "*" then got = string.rep(first,second) elseif method == "/" then got = mysplit(first,second) -- Temporary function mysplit used end return got end

print(arithOnString("-","omg","m")) print(arithOnString("*","aha,",6)) print(displayTable(arithOnString("/","oh goodness me :/"," "),"Splitted"))