fcf.escapeQuotes() function
Package: fcf-framework-core
File: fcf-framework-core:fcf.js
Available from version: 2.0.2
Escapes single and double quotes with \
Arguments
- Source string
- If the parameter is specified and contains the value of the escaped character or an array of escaped characters, then only the specified character and the \ character are escaped.
Result
- String with escaped characters
Example: Function application
{
let result = fcf.escapeQuotes("test string 1: \\ \" ' ");
console.log(result);
}
{
let result = fcf.escapeQuotes("test string 2: \\ \" ' ", "\"");
console.log(result);
}
{
let result = fcf.escapeQuotes("test string 3: \\ \" ' ", "'");
console.log(result);
}
{
let result = fcf.escapeQuotes("test string 4: \\ \" ' `", "`");
console.log(result);
}
{
let result = fcf.escapeQuotes("test string 5: \\ \" ' `", ["\"", "'", "`"]);
console.log(result);
}
Output:
test string 1: \\ \" \'
test string 2: \\ \" '
test string 3: \\ " \'
test string 4: \\ " ' \`
test string 5: \\ \" \' \`