• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Module:NanaminFunctions

From Kancolle Wiki
Revision as of 07:20, 20 April 2015 by Nanamin (talk | contribs) (Created page with "local NanaminFunctions = {} function NanaminFunctions.split(haystack, needle) local result = {} while mw.ustring.find(haystack, needle) do local split = mw.us...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

local NanaminFunctions = {}

function NanaminFunctions.split(haystack, needle)
    local result = {}
    while mw.ustring.find(haystack, needle) do
        local split = mw.ustring.find(haystack, needle)
        table.insert(result, mw.ustring.sub(haystack, 1, split - 1))
        haystack = mw.ustring.sub(haystack, split + 1)
    end
    table.insert(result, haystack)
    return result
end

return NanaminFunctions