-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package utils | ||
|
||
import "strings" | ||
|
||
// EscapeSingleQuote replaces all occurrences of single quote, with 2 single quotes. | ||
// For requests that use single quotes, if any parameter values also contain single quotes, | ||
// those must be double escaped; otherwise, the request will fail due to invalid syntax. | ||
// https://docs.microsoft.com/en-us/graph/query-parameters#escaping-single-quotes | ||
func EscapeSingleQuote(qparam string) string { | ||
return strings.ReplaceAll(qparam, `'`, `''`) | ||
} |