Created
April 13, 2016 20:03
-
-
Save dimiro1/c365974bb6366cd599babe7eaf455e71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func escapeQuery(s string) string { | |
s1 := regexp.QuoteMeta(s) | |
re := regexp.MustCompile("\\s+") | |
s1 = strings.TrimSpace(re.ReplaceAllString(s1, " ")) | |
return s1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment