0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ruby学習#8 Working With String

0
Posted at

"を出力する場合、バックスラッシュ 
mac だと Option + ¥マーク

8 Working With String

puts "Giraffe" Academy"
# Giraffe" Academy

phrase = "Giraffe Academy"
puts phrase
#Giraffe Academy
puts.upcase()
#GIRAFFE ACADEMY
puts.downcase()
#giraffe academy
phrase = " Giraffe Academy "
puts phrase.strip()
#Giraffe Academy
#スペースとれる
puts.phrase.length()
#15
puts phrase.include? "Academy"
#true
puts phrase.include? "Academys"
#false
puts phrase[0]
#G
puts phrase[3]
#a
puts phrase[0,3]
#Gir
puts phrase.index(G)
#0
puts phrase.index(ffe)
#4
puts "programming".upcase()
#PROGRAMMING

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?