String split help

I have string: "xxx | yyy | zzz | ddd"

I need to split it to: "xxx", "yyy", "zzz" and "ddd",
make link to every word like: <a href="xxx">xxx</a>

So result must by:

from this: "xxx | yyy | zzz | ddd" to this:

"<a href="xxx">xxx</a>, <a href="yyy">yyy</a>, <a href="zzz">zzz</>, <a
href="ddd">ddd</a>"

How can I do it?

"xxx | yyy | zzz | ddd".split()....map{}....join()

I'll let you figure out what goes into the () and {}'s :slight_smile:

"xxx | yyy | zzz | ddd".split(" | ") # => ["xxx", "yyy", "zzz", "ddd"]