mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-12-12 16:35:10 +00:00
0a8757baba
This is a reimplementation of Lua's string library with support for UTF-8. The entire ustring library is implemented in pure Lua. PHP callbacks are also available for overrides: in LuaSandbox these are used for almost all functions, while in LuaStandalone they are used only for the pattern matching. Also, ustring.upper and ustring.lower are overridden using mw.language's .uc and .lc if available. It also includes a bunch of unit tests. Note that if you download the normalization tests, they may fail under LuaSandbox if you have PHP's intl extension installed and libicu on your system is too old. Change-Id: Ie76fdf8d3a85d0a3d2a41b0d3b7afe433f247af0
16 lines
462 B
Lua
16 lines
462 B
Lua
string.isutf8 = ustring.isutf8
|
|
string.byteoffset = ustring.byteoffset
|
|
string.codepoint = ustring.codepoint
|
|
string.gcodepoint = ustring.gcodepoint
|
|
string.toNFC = ustring.toNFC
|
|
string.toNFD = ustring.toNFD
|
|
string.uchar = ustring.char
|
|
string.ulen = ustring.len
|
|
string.usub = ustring.sub
|
|
string.uupper = ustring.upper
|
|
string.ulower = ustring.lower
|
|
string.ufind = ustring.find
|
|
string.umatch = ustring.match
|
|
string.ugmatch = ustring.gmatch
|
|
string.ugsub = ustring.gsub
|