2011-08-28 23:32:24 +02:00
|
|
|
function string:split(sep)
|
|
|
|
local t = { }
|
|
|
|
local function helper(word)
|
|
|
|
table.insert(t, word)
|
|
|
|
return ""
|
|
|
|
end
|
|
|
|
if not self:gsub("%w+", helper):find("%S") then
|
|
|
|
return t
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function string:starts(start)
|
2011-11-16 19:59:55 +01:00
|
|
|
return self:sub(1, #start) == start
|
2011-08-28 23:32:24 +02:00
|
|
|
end
|
2011-11-16 19:59:55 +01:00
|
|
|
|
2011-12-07 01:31:55 +01:00
|
|
|
function string:trim()
|
|
|
|
return self:match('^%s*(.*%S)') or ''
|
2011-11-16 19:59:55 +01:00
|
|
|
end
|