diff options
Diffstat (limited to 'util.lua')
| -rw-r--r-- | util.lua | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -22,6 +22,14 @@ function util.strip(str) return (str:gsub('^%s*(.-)%s*$', '%1')) end +function util.strip_ne(str) + if str == nil then + return nil + end + local str = util.strip(tostring(str)) + return str ~= '' and str or nil +end + -- skips over utf8 continuation bytes (10xxxxxx) -- valid positions range from 1 to #str + 1 (*after* the last byte) function util.utf8_seek(str, pos, n) |
