Skip to content

Instantly share code, notes, and snippets.

@jerbear2008
Last active October 30, 2021 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerbear2008/4137f88035272c33a63c8b4b4d1e3592 to your computer and use it in GitHub Desktop.
Save jerbear2008/4137f88035272c33a63c8b4b4d1e3592 to your computer and use it in GitHub Desktop.
per-line formatting
let text = `We’re no strangers to love
You know the rules and so do I
A full commitment’s what I’m thinking of
You wouldn’t get this from any other guy
I just wanna tell you how I’m feeling
Gotta make you understand
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
We’ve known each other for so long
Your heart’s been aching but you’re too shy to say it
Inside we both know what’s been going on
We know the game and we’re gonna play it
And if you ask me how I’m feeling
Don’t tell me you’re too blind to see
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you`
let start = "**__"
let end = "__**"
let exclude = ""
let output = ""
let lines = text.split('\n')
lines.forEach(line => {
output += '\n'
if(!line){
output += '\n'
return
}
if(start) output += start
let chars = line.split('')
chars.forEach(char => {
if(exclude == char) return
output += char
})
if(end) output += end
})
output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment