Created
August 18, 2015 01:02
-
-
Save eternal44/f16fe1a45276c51f3cc6 to your computer and use it in GitHub Desktop.
2_week/1e_split_a_string.rb
This file contains hidden or 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
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