Jump to content

Module:string/endswith

Wiktionary වෙතින්


local sub = string.sub

--[==[
Returns {true} if the string {str} ends with the string {val}, or {false} if not. The optional indices {i} and {j} can be used to check a substring of {str}.

Note that {val} is a string literal, not a Lua pattern.]==]
return function(str, val, i, j)
	return sub(i == nil and j == nil and str or sub(str, i, j), -#val) == val
end
"https://si.wiktionary.org/w/index.php?title=Module:string/endswith&oldid=222228" වෙතින් සම්ප්‍රවේශනය කෙරිණි