lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

This library [1] provides Lua5.1 string.* functions support for UTF8 strings.

examples:
local str = "пыщпыщ ололоо я водитель нло"
print(str:find("(.л.+)н"))
-- 8    26  ололоо я водитель 

print(str:gsub("ло+", "보라"))
-- пыщпыщ о보라보라 я водитель н보라 3

print(str:match("^п[лопыщ ]*я"))
-- пыщпыщ ололоо я

Although there are pattern classes that works only with ASCII codes: %a, %l, %p, %u, %w  it is useful enough.

[1] https://github.com/Stepets/utf8.lua

P.S. It was written about 1.5 years ago, so this is kinda "late-announce"

--
С уважением, Алимов Степан Геннадьевич.