diff --git a/Scripts/JoinLinesWithCommaAndSingleQuote.js b/Scripts/JoinLinesWithCommaAndSingleQuote.js new file mode 100644 index 00000000..2bcbe41f --- /dev/null +++ b/Scripts/JoinLinesWithCommaAndSingleQuote.js @@ -0,0 +1,17 @@ +/** + { + "api":1, + "name":"Join Lines With Comma and Single Quote", + "description":"Joins all lines with a comma.", + "author":"pweiss82", + "icon":"collapse", + "tags":"join, comma, single-quote", + "bias": -0.1 + } +**/ + +function main(input) { + // Wrap each line in single quotes and join with comma + input.text = input.text.replace(/\n/g, "', '"); + input.text = "'" + input.text + "'"; +}