aboutsummaryrefslogtreecommitdiff
path: root/string2.moon
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.moon
parent307dea18815ba4a06a3098edb170d7ad90708815 (diff)
Tweak
Diffstat (limited to 'string2.moon')
-rw-r--r--string2.moon1
1 files changed, 1 insertions, 0 deletions
diff --git a/string2.moon b/string2.moon
index e4ee482..e6db628 100644
--- a/string2.moon
+++ b/string2.moon
@@ -27,6 +27,7 @@ string2 = {
byte: byte, bytes: (i, j)=> {byte(@, i or 1, j or -1)}
split: (sep)=> [chunk for i,chunk in isplit(@, sep)]
starts_with: (s)=> sub(@, 1, #s) == s
+ ends_with: (s)=> #@ >= #s and sub(@, #@-#s, -1) == s
lines: => [line for i,line in isplit(@, '\n')]
line: (line_num)=>
for i, line, start in isplit(@, '\n')