Ruby Methods Flashcards
puts
kernel method that outputs a statement to the screen as a string
to_s
converts to string
to_i
converts to integer
to_f
converts to float
gets
a kernel method to retrieve strings
chomp
removes the carriage return from user inputs
reverse
reverses a string
length
gives the total amount if characters in a string, including spaces. the result is an integer.
also gives the number of objects in an array.
upcase
changes all letters to uppercase
downcase
changes all letters to lowercase
swapcase
switches the cases on letters
capitalize
changes the first character in a string to uppercase if it is a letter
center
centers a string on a line. argument = total line width to center the string in.
ljust
left justifies a string on a line. argument = total line width to center the string in.
rjust
right justifies a string on a line. argument = total line width to right justify the string in.