This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing.
This module implements {{str endswith}}. Please see the template page for documentation.
-- This module implements {{str endswith}}.localTRUE_STRING='yes'localFALSE_STRING=''localp={}localfunctiontrim(s)returns:match('^%s*(.-)%s*$')endfunctionp.main(frame)localargs=frame:getParent().argslocals=args[1]localpattern=args[2]ifnotsornotpatternthen-- TRUE_STRING is not the natural choice here, but is needed for-- backwards compatibility.returnTRUE_STRINGends=trim(s)pattern=trim(pattern)ifpattern==''then-- All strings end with the empty string.returnTRUE_STRINGendifmw.ustring.sub(s,0-mw.ustring.len(pattern),-1)==patternthenreturnTRUE_STRINGelsereturnFALSE_STRINGendendreturnp