Hello | World") // Hello World * @example 2. removeHTMLTags("This is a test | string") // This is a test string */ function removeHTMLTags(str) { if (typeof str !== 'string' || !str) return ''; let output = ''; let insideTag = false; for (let i = 0; i < str.length; i++) { const char = str[i]; // Start of a tag if (char === '<') { insideTag = true; continue; } // End of a tag if (char === '>' && insideTag) { insideTag = false; continue; } // Write only characters outside of tags if (!insideTag) { output += char; } } return output; }; /** * Function to remove single quotes from a string * @author Alok Raj : D111793 * @param {string} str - The input string from which single quotes need to be removed. * @returns {string} - The input string with all single quotes removed. * @example 1. removeSingleQuotes("It's a test") // Its a test * @example 2. removeSingleQuotes("Don't worry") // Dont worry */ function removeSingleQuotes(str) { if (typeof str !== 'string' || !str) return ''; let output = ''; for (let i = 0; i < str.length; i++) { const char = str[i]; if (char !== "'") { output += char; } } return output; }; /** * Function to remove double quotes from a string * @author Alok Raj : D111793 * @param {string} str - The input string from which double quotes need to be removed. * @returns {string} - The input string with all double quotes removed. * @example 1. removeDoubleQuotes('He said, "Hello!"') // He said, Hello! * @example 2. removeDoubleQuotes('"Quoted Text"') // Quoted Text */ function removeDoubleQuotes(str) { if (typeof str !== 'string' || !str) return ''; let output = ''; for (let i = 0; i < str.length; i++) { const char = str[i]; if (char !== '"') { output += char; } } return output; }; /** * Function to remove both single and double quotes from a string * @author Alok Raj : D111793 * @param {string} str - The input string from which quotes need to be removed. * @returns {string} - The input string with all single and double quotes removed. * @example 1. removeQuotes("He said, 'Hello!'") // He said, Hello! * @example 2. removeQuotes('She said, "Hi!"') // She said, Hi! */ function removeQuotes(str) { if (typeof str !== 'string' || !str) return ''; let output = ''; for (let i = 0; i < str.length; i++) { const char = str[i]; if (char !== "'" && char !== '"') { output += char; } } return output; }