Skip to main content

addslashes

Add slashes before quotes. Useful for escaping strings in CSV, for example. Less useful for escaping JavaScript; use the escapejs filter instead.

def addslashes(
value: string
) - > string

Add slashes before quotes. Useful for escaping strings in CSV, for example. Less useful for escaping JavaScript; use the escapejs filter instead.

Parameters

NameTypeDescription
valuestringThe input string to be escaped.

Returns

TypeDescription
stringThe input string with backslashes, double quotes, and single quotes escaped with a preceding backslash.