From 63d4db3671ab024912288dd641af41c8d06c42ab Mon Sep 17 00:00:00 2001 From: Zachary Picco Date: Tue, 26 Aug 2025 10:38:09 -0500 Subject: [PATCH] Returns a boolean indicating if the first string ends with the second string. --- lib/string.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/string.lua b/lib/string.lua index 354f3c9..2ee3f4a 100644 --- a/lib/string.lua +++ b/lib/string.lua @@ -26,3 +26,11 @@ end string.starts_with = function(s, start) return s:sub(1, #start) == start end + +---Returns a boolean indicating if the first string ends with the second string. +---@param s string +---@param suffix string +---@return boolean +string.ends_with = function(s, suffix) + return s:sub(-#suffix) == suffix +end