Mòdul:StringFunc: diferència entre les revisions

Contingut suprimit Contingut afegit
arreglo funció split, només per text pla
Cap resum de modificació
Línia 60:
local ret_count = tonumber( new_args['count'] ) or 1;
local start = 1;
local iter = mw.ustring.find(source_str, pattern, start, plain) - 1;
if iter == nil then
if ret_count == 1 then
return source_str;
else
return "";
end
else
iter = iter - 1;
end
if ret_count == 1 then
Linha 69 ⟶ 75:
for i=2, ret_count do
start = iter+pattern_len + 1;
iter = mw.ustring.find(source_str, pattern, start, plain) - 1;
if iter == nil then
breakif ret_count == i then
return mw.ustring.sub(source_str, start, mw.ustring.len(source_str));
else
return "";
end
else
iter = iter - 1;
end
end