-
-
Save mistyrinth/a97e1ea32ef8e61b560c9615af8945fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
str = "Welcome" | |
puts "元の文字列は #{str} です" | |
# 文字列の挿入 | |
ins = str.insert(3,"yes") | |
puts "3番目の位置に yes を挿入すると #{ins} です" | |
# 文字列の検索 | |
str = "Welcome" | |
pos = str.index("co") | |
puts "co を検索した結果、左からの位置は #{pos} 番目です" | |
puts "come が含まれているかどうかの結果は #{str.include?("come")} です" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment