Skip to content
Advertisement

How can i add a new line every nth delimiter of a string in python? [closed]

I am trying to add a new line, for every nth delimiter in a string.

For example i will add a new line every 3rd ‘|’ in the string below:

JavaScript

Advertisement

Answer

Here is an implementation

JavaScript

Usage:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement