-
-
Save mistyrinth/41609e8e634820368a97ac6ef4a2c34c 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} です" | |
# 文字列の取得 | |
puts "str[2,4]は #{str[2,4]} です" | |
puts "str[2..4]は #{str[2..4]} です" | |
puts "str[2...4]は #{str[2...4]} です" | |
# 文字列の置き換え | |
str[2..4] = "abc" | |
puts "str[2..4]を置き換えた後の文字列は #{str} です" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment