[ create a new paste ] login | about

Link: http://codepad.org/6RxG2S7M    [ raw code | output | fork ]

slevy1ster - Ruby, pasted on Nov 12:
1
2
3
4
5
6
7
8
#no need to create array first

myStr = String.new('1,2,3\n4,5,6\n7,8,9')
puts "The data:\n#{myStr}\n"
nocom = myStr.gsub(/,/,'') 
puts "Commas are gone as follows: #{nocom}"
arr = nocom.split(/\\n/)
puts arr


Output:
1
2
3
4
5
6
The data:
1,2,3\n4,5,6\n7,8,9
Commas are gone as follows: 123\n456\n789
123
456
789


Create a new paste based on this one


Comments: