Commit 168aa5fe authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

util: startswithupper function

parent ae381965
......@@ -602,8 +602,9 @@ end
function M.Rule:customtarget()
if self.action then
local as = self.action:sub(1, 1)
if as == as:upper() or startswith(self.action, 'custom:') then
if util.startswithupper(self.action) or startswith(
self.action, 'custom:'
) then
return self.action
end
end
......
--[[
Utility module for Alpine Wall
Copyright (C) 2012-2019 Kaarle Ritvanen
Copyright (C) 2012-2020 Kaarle Ritvanen
See LICENSE file for license details
]]--
......@@ -121,6 +121,12 @@ function M.join(a, sep, b)
end
function M.startswithupper(s)
if s == '' then return false end
local c = s:sub(1, 1)
return c == c:upper()
end
function M.quote(s) return '"'..s:gsub('(["\\])', '\\%1')..'"' end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment