Q:

Write a Ruby program to split a delimited string and convert it to an array

0

Write a Ruby program to split a delimited string and convert it to an array.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

def check_string(my_string,d)
   return my_string.split(d)
  return my_string
end
print check_string("A,B,C,D,E,F", ",")
print "\n",check_string("A.B.C.D.E.F", ".")

Output:

["A", "B", "C", "D", "E", "F"]
["A", "B", "C", "D", "E", "F"]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now