/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/lua/lua-515-172-001/main.lua
19 строк
487 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
function split(str, sep) local parts = {} local start = 1 local sepLen = #sep while true do local pos = string.find(str, sep, start, true) if not pos then break end table.insert(parts, string.sub(str, start, pos - 1)) start = pos + sepLen end table.insert(parts, string.sub(str, start)) return parts end local data = "apple,banana,cherry" local fruits = split(data, ",") for _, fruit in ipairs(fruits) do print(fruit) end