Module:Str find word: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 1:
--- STABLE: 16-11-2021 20:30
-- todo: sep = len 1 max
-- not %escapseescape then?
 
require('Module:No globals')
Line 8:
local str = require('Module:String')
local yesno = require('Module:Yesno')
---- local sSep = ', '
local defaultSep = ','
local iMaxWords = 16
Line 321 ⟶ 320:
-- set wordt separator
local function setSep(sSep)
if sSep == nil orthen sSepreturn == '' thendefaultSep end
local msg = ''
-- todo what with {{!}}
-- comma-space? / does not matter
local newSep = defaultSep
 
if sSep == nil or sSep == '' then
newSep = defaultSep
end
newSep = sSep
sSep = decodeUnicode(sSep or '')
if string.match(sSep, '[%s%w%d]') ~= nil then -- not ok ok
msg = 'Irregular characters in sep: ' .. sSep
Line 353 ⟶ 349:
local function parseArgs(origArgs)
local newArgs = {}
newArgs['sep'] = setSep(origArgs['sep'] or '') -- fistfirst, needed below
newArgs['source'] = decodeUnicode(origArgs['s'] or origArgs['source'] or '')
newArgs['andString'] = decodeUnicode(concatAndLists(