Module:String: Difference between revisions

replace_plain fix
m>WOSlinker
(add str.replace_plain)
m>WOSlinker
(replace_plain fix)
Line 175: Line 175:
     local pattern_plain = mw.ustring.gsub(pattern, '%%', '%%%%');
     local pattern_plain = mw.ustring.gsub(pattern, '%%', '%%%%');
     local replace_plain = mw.ustring.gsub(replace, '%%', '%%%%');
     local replace_plain = mw.ustring.gsub(replace, '%%', '%%%%');
    local result;


     if firstonly == 'true' or firstonly == 'yes' or firstonly == '1' then
     if firstonly == 'true' or firstonly == 'yes' or firstonly == '1' then
         local result = mw.ustring.gsub( source_str, pattern_plain, replace_plain, 1 );
         result = mw.ustring.gsub( source_str, pattern_plain, replace_plain, 1 );
     else
     else
         local result = mw.ustring.gsub( source_str, pattern_plain, replace_plain, n );
         result = mw.ustring.gsub( source_str, pattern_plain, replace_plain, n );
     end
     end


Anonymous user