util.string.lower
Shared
Converts all uppercase letters to lowercase
Syntax
local result = util.string.lower(
input
)Parameters
| Type | Name | Description |
|---|---|---|
string | input | String to convert |
Returns
| Type | Name | Description |
|---|---|---|
string | result | Altered string with all uppercase letters converted to lowercase |
Examples
local result = util.string.lower("HELLO")
core.engine.print("info", result) -- 'hello'local result = util.string.lower("Hello World")
core.engine.print("info", result) -- 'hello world'local result = util.string.lower("already lowercase")
core.engine.print("info", result) -- 'already lowercase'local result = util.string.lower("ABC123!@#")
core.engine.print("info", result) -- 'abc123!@#'local str1 = "Hello"
local str2 = "HELLO"
if util.string.lower(str1) == util.string.lower(str2) then
core.engine.print("info", "Strings are equal (case-insensitive)")
endlocal input = "YES"
if util.string.lower(input) == "yes" then
core.engine.print("info", "User confirmed")
endlocal data = {
Name = "John",
Age = 25,
City = "NYC"
}
for key, value in pairs(data) do
core.engine.print("info", util.string.lower(key), value)
end
--[[
Output:
'name John'
'age 25'
'city NYC'
]]local email = "User@Example.COM"
local normalized = util.string.lower(email)
core.engine.print("info", normalized) -- 'user@example.com'local result = util.string.lower("123456")
core.engine.print("info", result) -- '123456'local result = util.string.lower("")
core.engine.print("info", result) -- ''local result = util.string.lower("HELLO WORLD"):gsub(" ", "_")
core.engine.print("info", result) -- 'hello_world'