Quick actions

cmd+k|ctrl+k

Navigation

Languages

UPPER-LOWER CASE

Snippet info

Language

Lua

Visibility

public

Author

boa-hacker

Created

2020-12-30T15:50:51Z

Updated

2020-12-30T15:50:51Z

local Option1 = false --true to convert first string to uppercase
local Option2 = false --true to convert all strings to uppercase
local Option3 = false --true to convert all strings to lowercase

local Text = [[
--Put your text here
]]

--Script
if Option1 and not Option2 and not Option3 then
    local String = Text:gsub("^%l", string.upper)
    print(String)
end
if not Option1 and Option2 and not Option3 then
    local String = Text:upper()
    print(String)
end
if not Option1 and not Option2 and Option3 then
    local String = Text:lower()
    print(String)
end

--Error
if not Option1 and not Option2 and not Option3 then
    print("Error: Please enable an option at line 1/2/3")
end
if Option1 and Option2 or Option2 and Option3 or Option1 and Option3 then
    print("Error: Please enable only one option at line 1/2/3!")
end
INFO