I want to split a string into an array using ";" , " " and "," delimiters on one line. Is there a way to do this without using regular expressions?
";"
" "
","
Just replace the delimiters with one delimiter and divide by that.
p "aaa;bbb ccc,ddd".tr(";,"," ").split #=> ["aaa", "bbb", "ccc", "ddd"]
Yes. Perhaps, but with a regular expression.
string.split(/[;, ]/)