1👍
One option is to use a regular expression between either ;
or \n
:
const doSplit = str => str.split(/;|\n/);
console.log(doSplit("- City\n - MU\n - Liverpool\n - Arsenal\n - Chelsea"));
console.log(doSplit("City;MU;Liverpool;Arsenal;Chelsea"));
Source:stackexchange.com