Open helpermethod opened 2 years ago
A slightly nicer alternative to the proposed solution would be
split_string() { # Usage: split_string "string" "delimiter" printf '%s\n' "${1//$2/$'\n'}" }
No need for creating an array first.
This is very nice, but it's a terrible name as it interferes with /usr/bin/split, leading to hard-to-trace bugs. Please rename it to split_string or somesuch :-)
/usr/bin/split
split_string
A slightly nicer alternative to the proposed solution would be
No need for creating an array first.