Differences From
Artifact [345c990ba7]:
- File
lib/str.lua
— part of check-in
[ea6e475e44]
at
2020-10-19 09:52:11
on branch trunk
— continue dev on celestial mechanics, add melding+division spells (resonance), refine itemclasses, add keypunch and punchcards, add paper pulp, add a shitload of visuals, add convenience scripts for working with the wiki, make the flamebolt spell actually useful instead of just a pretty lightshow, add essences, inferno crystal, and other goodies; iterate on wands, lots of shit i can't remember, various bugfixes
(user:
lexi,
size: 2983)
[annotate]
[blame]
[check-ins using]
12 12 return {
13 13 capitalize = function(str)
14 14 return string.upper(string.sub(str, 1,1)) .. string.sub(str, 2)
15 15 end;
16 16
17 17 beginswith = function(str,pfx)
18 18 if #str < #pfx then return false end
19 - return string.sub(str,1,#pfx) == pfx
19 + if string.sub(str,1,#pfx) == pfx then
20 + return true, string.sub(str,1 + #pfx)
21 + end
20 22 end;
21 23
22 24 endswith = function(str,sfx)
23 25 if #str < #sfx then return false end
24 - return string.sub(str,#sfx) == sfx
26 + if string.sub(str,#sfx) == sfx then
27 + return true, string.sub(str,1,#sfx)
28 + end
25 29 end;
26 30
27 31 explode = function(str,delim,pat) -- this is messy as fuck but it works so im keeping it
28 32 local i = 1
29 33 local tbl = {}
30 34 if pat == nil then pat = false end
31 35 repeat