This Gist was automatically created by Carbide, a free online programming environment.
Last active
October 30, 2021 02:27
-
-
Save jerbear2008/4137f88035272c33a63c8b4b4d1e3592 to your computer and use it in GitHub Desktop.
per-line formatting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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