I ned to write a string that could escape both these strings.
str = "We couldn't help"
str = "We couldn't help."
I achieved that using
CGI.escapeHTML(CGI.unescapeHTML(str))
Now however I have a new requirement of accomodating HTML tags as well.
str = "We couldn't help. Check <a href = https://www.google.com>link</a> for help"
How can I escape the string except the HTML tags ? So that I can escape all these 3 kinds of strings.