/
silly_string.rb
23 lines (15 loc) · 916 Bytes
/
silly_string.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#code your solutions here
#1: Create a string that contains your favorite word. It can be in any language!
puts "effervescent"
#2: Using a method built into ruby, capitalize every letter in the string you just created
puts "effervescent".upcase
#3: Now let's make all the characters lowercase in the string below:
puts "IM NOT SHOUTING".downcase
#4: Using a method built into ruby, count how many letters are in the string below:
puts "supercalifragilisticexpialidocious".length
#5: Let's add the two strings together below using concatenation.
puts "wow" + "mom"
#6. Let's capitalize the first character of the string below:
puts "i really like programming".capitalize
#7 Replace all "A" with "O" and "a" with "o" by chaining together `gsub`
puts "Astounding aardvarks, arguably an ancient animal, always ate apples and acorns and artichokes all around Athens, amazing!".gsub(/[AOao]/,'A'=>"O", "a"=>"o")