S★
Size: a a a
S★
S★
S★
АХ
АХ
АХ
S★
В
AK
—————————————————————
local explode = function( seperator, str )
local pos, arr = 0, {}
for st, sp in function() return string.find( str, seperator, pos, true ) end do -- for each divider found
table.insert( arr, string.sub( str, pos, st-1 ) ) -- attach chars left of current divider
pos = sp + 1 -- jump past current divider
end
table.insert( arr, string.sub( str, pos ) ) -- attach chars right of last divider
return arr
end
—— main
arr = {}
my_string = '123456##6789##75454'
arr = explode("##", my_string )
IO
—————————————————————
local explode = function( seperator, str )
local pos, arr = 0, {}
for st, sp in function() return string.find( str, seperator, pos, true ) end do -- for each divider found
table.insert( arr, string.sub( str, pos, st-1 ) ) -- attach chars left of current divider
pos = sp + 1 -- jump past current divider
end
table.insert( arr, string.sub( str, pos ) ) -- attach chars right of last divider
return arr
end
—— main
arr = {}
my_string = '123456##6789##75454'
arr = explode("##", my_string )
function string:split(sep)А потом
if sep == "" then
local fields = {}
table.insert(fields, self)
return fields
end
local sep, fields = sep or ",", {}
local pattern = string.format("([^%s]+)", sep)
self:gsub(pattern, function(c) fields[#fields+1] = c end)
return fields
end
local str = «a:b:c:d»
a = str.split(‘:’)
— a = {‘a’, ‘b’, ‘c’ ‘d’}
IO
AK
AK
IO
markdown
AK
markdown
AK
markdown
AK
я шмагла
V
NS