Ruby String Exercises: Split a delimited string and convert it to an array
Ruby String: Exercise-7 with Solution
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", ".")
["A", "B", "C", "D", "E", "F"] ["A", "B", "C", "D", "E", "F"]
Ruby Code Editor:
Contribute your code and comments through Disqus.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework