Skip to content

Instantly share code, notes, and snippets.

@GreenFootballs
Last active April 1, 2017 17:41
Show Gist options
  • Save GreenFootballs/d487bce7fe30df9db9ff9b5c71031ab1 to your computer and use it in GitHub Desktop.
Save GreenFootballs/d487bce7fe30df9db9ff9b5c71031ab1 to your computer and use it in GitHub Desktop.
An Applescript subroutine that mimics PHP's addslashes() to escape single/double quotes
on addslashes(s)
	return (do shell script "sed 's/[\"\\\\'\\'']/\\\\&/g' <<<" & quoted form of s)
end addslashes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment