diff options
Diffstat (limited to 'lua/colorizer/utils.lua')
-rw-r--r-- | lua/colorizer/utils.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lua/colorizer/utils.lua b/lua/colorizer/utils.lua index 282e405..724b46e 100644 --- a/lua/colorizer/utils.lua +++ b/lua/colorizer/utils.lua @@ -71,6 +71,14 @@ function utils.byte_is_valid_colorchar(byte) return utils.byte_is_alphanumeric(byte) or byte == ("-"):byte() end +---Count the number of character in a string +---@param str string +---@param pattern string +---@return number +function utils.count(str, pattern) + return select(2, string.gsub(str, pattern, "")) +end + --- Get last modified time of a file ---@param path string: file path ---@return number|nil: modified time |