--!native -- Compiled with roblox-ts v3.0.0 local StringTools = {} do local _container = StringTools local random = Random.new() local min = math.min local round = math.round --to convers characters into array of characters local characters = string.split("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "") local max_itteractions = 100 --*generates a unique string id with requested length local function GenerateStringId(length, exceptions) if exceptions == nil then exceptions = {} end local id = "" local itteration = 0 repeat do --prevents from breaking the code; itteration += 1 if itteration > max_itteractions then warn("Exeded amount of itterations") break end --resets the id id = "" for i = 1, length do --takes the random character and appends it local random_character_index = random:NextInteger(0, #characters - 1) id ..= characters[random_character_index + 1] end --recreates id if it exists in exceptions; end local _exceptions = exceptions local _id = id until not (table.find(_exceptions, _id) ~= nil) return id end _container.GenerateStringId = GenerateStringId --*lerps text with alpha local function LerpText(text, alpha) --lerps the amount of characters local amount_of_characters = #text local lerped_text_size = min(round(amount_of_characters * alpha), amount_of_characters) return string.sub(text, 1, lerped_text_size) end _container.LerpText = LerpText local function LerpTextTo(start_text, target_text, alpha) local max_size = math.max(#start_text, #target_text) --place where there will be transition from start text to target text; -- const lerped_position_index = math.floor(max_size * (1 - alpha)); local lerped_position_index = math.floor(max_size * alpha) local part_1 = string.sub(target_text, 1, lerped_position_index) local _start_text = start_text local _arg0 = lerped_position_index + 1 local part_2 = string.sub(_start_text, _arg0) return part_1 .. part_2 end _container.LerpTextTo = LerpTextTo local function IsUndefinedOrEmpty(string_value) return string_value == "" or string_value == nil end _container.IsUndefinedOrEmpty = IsUndefinedOrEmpty local function IsUndefinedOrEmptyOrWhiteSpace(string_value) if string_value == "" or string_value == nil then return true end local characters = string.split(string_value, " ") for _, character in characters do if character ~= "" then return false end end return true end _container.IsUndefinedOrEmptyOrWhiteSpace = IsUndefinedOrEmptyOrWhiteSpace end return { StringTools = StringTools, }