I'm wondering a good way of splitting strings by a |
delimiter if the input strings could be of the following form:
"foo, bar"
"foo ,bar"
"foo,bar"
"foo , bar"
"foo bar"
"foo,,bar"
So the only possible outputs strings are as:
"foo|bar"
"foo|bar|other|here"
Independently of how many terms are within the input string.
Any thoughts would be appreciated!