Need Help With String Patterns

Hello. So basically I’m trying to convert the following string “FRANCE” to “France” but I have no idea how to go about converting it. I’m not very familiar with string patterns :pensive: Help would be appreciated.

One way:

local str = "FRANCE"
local cap = str:lower():gsub("%a", string.upper, 1)
print(cap) --> France
2 Likes

Great solution! It’s efficient and flexible I like it :+1:

1 Like