function title case(theString)
return (theString:gsub("^%a", string.upper):gsub("%s+%a", string.upper))
end
I have the above mentioned code. I wanted to know the use of
^
operator in the above code. I know that^
is used in sets to exclude/negate the succeeding values in a set but since it's not a set, what is^
meant for ?Why is
gsub
used twice in above code? Both the times, the letters are being converted to upper case! Please explain what's exactly happening in above line of code.