Skip to content

Instantly share code, notes, and snippets.

@eternal44
Created August 18, 2015 01:02
Show Gist options
  • Save eternal44/f16fe1a45276c51f3cc6 to your computer and use it in GitHub Desktop.
Save eternal44/f16fe1a45276c51f3cc6 to your computer and use it in GitHub Desktop.
2_week/1e_split_a_string.rb
def split_message(message)
lst = message.split("\n")
count = 1
lst.each do |part|
puts "Line #{count}:" + part
puts ""
count += 1
end
end
split_message("Welcome to the forum.\nHere you can learn Ruby.\n"\
"Along with other members.\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment