https://bugzilla.wikimedia.org/show_bug.cgi?id=48378

       Web browser: ---
            Bug ID: 48378
           Summary: Why use gsub in mw.text.trim?
           Product: MediaWiki extensions
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: Unprioritized
         Component: Scribunto
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]
    Classification: Unclassified
   Mobile Platform: ---

Hi!
I don't know why gsub is used in function mw.text.trim in mw.text.lua; I would
have written that function as following:

function mwtext.trim( s, charset )
        charset = charset or '\t\r\n\f '
        return mw.ustring.match( s, '^[' .. charset .. ']*(.-)[' .. charset ..
']*$' )
end

Also I would have made a mw.text.trim using the string library, and a
mw.text.utrim using ustring, since it would probably be used most of the time
with 1-byte characters...

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to