lua-users home
lua-l archive

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


2018-07-10 15:30 GMT+02:00 Lorenzo Donati <lorenzodonatibz@tiscali.it>:

> Unicode is great for typesetting (I use regularly LaTeX and it's fun to find
> almost every symbol you may imagine, even ancient German runic scripts!),
> but it sucks (IMHO) for general programming or computer-related stuff. Too
> much mind overhead to use correctly for little gain.

Yes, yes, but — if you will allow me to return to Lua and UTF-8 — there would
be more gain for a programmer if we had (if it is not too late already
for Lua 5.4)
utf8 versions of find, sub, match, gsub, gmatch, reverse. Just those, not asking
for upper/lower, operating only on simple codepoints, no combining characters,
no need for a C library.

utf8.find ("Hélène",'n')  --> 5 5
utf8.sub ("Hélène",5)   --> 'ne'
utf8.gsub ("Hélène","[éè]","e")  --> 'Helene' 2
utf8.reverse ("Hélène")   --> 'enèléH'