Write a Ruby program to split a delimited string and convert it to an array.
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"]
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer