'Remove punctuation at end of line in responsive text block

I have a list of a large number of Things divided by bars, i.e. Thing 1 | Thing 2 | Thing 3. They're in a responsive container and so I have no way of knowing where line-breaks will occur. If the Thing is at the end of a line I don't want it to have a bar, so I would need to remove them dependent on where the bars sit within the text block. Is there a way to do this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source