Script Luar Page
-- -------------------------------------------- -- 5. DEBUGGING / TIMING -- -------------------------------------------- local debug_utils = {}
-- -------------------------------------------- -- 6. EXAMPLE USAGE (commented out) -- -------------------------------------------- --[[ local my_string = " hello world " print(string_utils.trim(my_string)) --> "hello world" local parts = string_utils.split("a,b,c", ",") --> {"a","b","c"} script luar
-- -------------------------------------------- -- 1. STRING UTILITIES -- -------------------------------------------- local string_utils = {} -- -------------------------------------------- -- 5
-- Trim whitespace from both ends function string_utils.trim(str) return str:match("^%s*(.-)%s*$") end "hello world" local parts = string_utils.split("a
-- Check if string ends with a suffix function string_utils.ends_with(str, suffix) return #suffix == 0 or str:sub(-#suffix) == suffix end