If I have a String I'm happy
and I like to use it in a string that uses single quotation marks ('), then I need to escape the quotation mark in the string.
In most of the time this is done by doing something I call "backslash escape": Just prefix the quotation mark with a backslash: 'I\'m happy'
. Other people seem to do this too: If I enter "backslash escape" on google lots of pages show up that explain the technique. Descriptive term, perfect.
But for example in SQL you'd write 'I''m happy'
. Is there a term for that? How to call that? Judging by google search results "repeat-the-quotation-mark-escape" is very unpopular: It just gives a bunch of unrelated stuff.
EDIT: Reading from the comments I believe I need to explain more why I am asking:
My current Java code has a method that escape strings using the mentioned principle. I need to give the method a descriptive name. Of course I could call it "sqlEscape", but it's not really the invention of SQL... Just calling the method plain "escape" does not give any hints on exactly how the method escapes the string...
escaping
is a general term - its meaning and implementation is context-specific. The fact that a backslash is often used to achieve this does not make 'backslash escaping' correct. in HTML or (as you note) SQL this is not the case.''
seems like a person with no mouth.