-- 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