aboutsummaryrefslogtreecommitdiff
path: root/string2.lua
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-11-02 15:10:17 -0700
committerBruce Hill <bruce@bruce-hill.com>2018-11-02 15:10:22 -0700
commitdc41f30c73c9686685e3a4183c1213fb4ba55c90 (patch)
tree279ca7da2de0efe2f363684f3c84a540635f11a8 /string2.lua
parent307dea18815ba4a06a3098edb170d7ad90708815 (diff)
Tweak
Diffstat (limited to 'string2.lua')
-rw-r--r--string2.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/string2.lua b/string2.lua
index cf86026..09cb5ea 100644
--- a/string2.lua
+++ b/string2.lua
@@ -81,6 +81,9 @@ local string2 = {
starts_with = function(self, s)
return sub(self, 1, #s) == s
end,
+ ends_with = function(self, s)
+ return #self >= #s and sub(self, #self - #s, -1) == s
+ end,
lines = function(self)
local _accum_0 = { }
local _len_0 = 1