Skip to content

Instantly share code, notes, and snippets.

@mistyrinth
Created November 28, 2018 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mistyrinth/d7fc26f6124d29db8316164b0fdfc3b2 to your computer and use it in GitHub Desktop.
Save mistyrinth/d7fc26f6124d29db8316164b0fdfc3b2 to your computer and use it in GitHub Desktop.
# 文字列の削除
str1 = "Welcome"
puts "元の文字列は #{str1} です"
newStr1 = str1.delete("Wel")
puts "Wel を削除した後の文字列は #{newStr1} です"
# 文字列の分割
str2 = "文章、文字、分割、テスト"
puts "元の文字列は「 #{str2} 」です"
newStr2 = str2.split("、")
puts "保存した配列は #{newStr2} となりました"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment