Cleans a string by removing leading/trailing whitespace from each line, removing empty lines, and joining the remaining lines with newline characters.
The input string to be cleaned.
A new string with cleaned content.
const input = " Hello \n World \n\n ";const cleaned = cleanString(input);console.log(cleaned); // Output: "Hello\nWorld" Copy
const input = " Hello \n World \n\n ";const cleaned = cleanString(input);console.log(cleaned); // Output: "Hello\nWorld"
Cleans a string by removing leading/trailing whitespace from each line, removing empty lines, and joining the remaining lines with newline characters.