[RAILS] ruby Uppercase letters
Uppercase lowercase in Ruby
Given a string y of length t consisting of lowercase letters of the half-width alphabet.
Convert the character string y to uppercase and output.
Value to be entered
The input is given in the following format.
y
Expected output
Output the character string with y converted to uppercase.
Input example 1
qiita
Output example 1
QIITA
My answer
python
y = gets
puts y.upcase
This time's point
I'm getting the string with gets on the first line
The character string y obtained in the second line is output by upcase method </ font>.
upcase method </ font> is a method to change from lowercase to uppercase. By the way, the opposite is the downcase method </ font>.
python
y = "AAAAA"
puts y.downcase
Output result
▶︎ AAAAA
It will be.
There are also swapcase method </ font> that reverses only lowercase letters and uppercase letters, and capitalize method </ font> that converts the first uppercase letter to lowercase letters. There is font>.
that's all!