This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
mrSLIMEguy's profile picture

Converting Strings to Uppercase and Lowercase

Started by mrSLIMEguy, 18 September 2012 - 06:34 AM
mrSLIMEguy #1
Posted 18 September 2012 - 08:34 AM
Does anyone know how I can convert a string to uppercase or lowercase?
I can use this in a menu with

Are you sure that you want to …. Y/N
>

so that it doen't have to be a capital Y or N, so it wont matter.
Luanub #2
Posted 18 September 2012 - 08:37 AM
Yes use the string API.

string.upper() to conver to upper case

string.lower() for lower case


print("Enter your name")
local input = read()
string.lower(input)
print(input)
lfairy #3
Posted 20 September 2012 - 07:34 AM
Believe it or not, Lua has a manual:

http://www.lua.org/manual/5.1/manual.html#5

The string functions can be found if you scroll down a bit:

http://www.lua.org/manual/5.1/manual.html#5.4