Topic on Project:Support desk

Module:String additional functions upper, lower and ascii

2
2001:4DD6:A31E:0:25B1:AD14:6CCD:6C1D (talkcontribs)

It would be nice to have functions lower and upper. Eg wtatennis.com requires for the players profiles a lowercase pagename. Currently this requires 26 nested calls to replace. Additionally it would be very helpfull to have a function ascii, which converts all special characters like á into the basic ascii form.

Bawolff (talkcontribs)

Is https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#mw.language:lc what you are looking for? mw.language.getContentLanguage():lc( "STRING To Lowercase" ) will do lowercase for all unicode, string.lower( "String" ) will do it for just ascii (and ignore non-ascii)

For converting to ascii. Its not perfect, but the best you can do is the following: string.gsub(mw.ustring.toNFKD( "STRING TO CONVERT TO ASCII HERE éà" ), "[\127-\255]", "" )

Reply to "Module:String additional functions upper, lower and ascii"