Keep a record of the problems and answers you solved to study Ruby's string manipulation methods.
Convert "This" "is" "a" "pen" to "This is a pen".
"This" + " is" + " a" + " pen"
"+" Can concatenate character strings.
Convert "BENZ, BMW, Audi" to ["BENZ", "BMW", "Audi"].
"BENZ, BMW, Audi".split(",")
[] Represents an array. The split method can split a string. If you use it like an answer, you can separate it with a comma.
Convert "apple" to "Apple".
"apple".capitalize
The capitalize method can capitalize the first letter.
Convert "qiita" to "atiiq".
"qiita".reverse
The reverse method can reverse a string.
Convert "Good morning" to "GOOD MORNING".
"Good morning".upcase
The upcase method can convert lowercase letters to uppercase.
Recommended Posts