diff options
Diffstat (limited to 'xmake/core/base/string.lua')
| -rw-r--r-- | xmake/core/base/string.lua | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/xmake/core/base/string.lua b/xmake/core/base/string.lua index d031a228f..13ca6c1fb 100644 --- a/xmake/core/base/string.lua +++ b/xmake/core/base/string.lua @@ -172,13 +172,11 @@ function string:split(delimiter, opt) local start = 1 local pos, epos = self:find(delimiter, start, opt and opt.plain) while pos do - if opt and opt.limit and opt.limit > 0 and #result + 1 >= opt.limit then - break - end local substr = self:sub(start, pos - 1) - if #substr > 0 then - table.insert(result, substr) - elseif opt and opt.strict then + if (#substr > 0) or (opt and opt.strict) then + if opt and opt.limit and opt.limit > 0 and #result + 1 >= opt.limit then + break + end table.insert(result, substr) end start = epos + 1 |
