Modul:Common: Unterschied zwischen den Versionen

keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Markierung: Zurückgesetzt
Zeile 172: Zeile 172:


function split(s, d)
function split(s, d)
    local result = {}
    local pattern = "(.-)" .. d -- .- bedeutet: alles bis zum ersten Vorkommen von delimiter
    local start = 1
    while true do
        local part, pos = string.match(s, pattern, start)
        if part then
            table.insert(result, part)
            start = pos + 1
        else
            table.insert(result, string.sub(s, start))
            break
        end
    end
    return result
end
function split_old(s, d)
if d == nil then d = "%s" end
if d == nil then d = "%s" end
local arr = {}
local arr = {}
82.367

Bearbeitungen