Blame view
string_sanitisation.go
302 Bytes
ea858b8a7 refactoring |
1 |
package webutility |
5f1346d2d SQLProtect replac... |
2 |
|
d66628295 cleaned up |
3 |
import "strings" |
5f1346d2d SQLProtect replac... |
4 |
|
707782344 lint; vet |
5 |
const patern = "\"';&*<>=\\`:" |
ea858b8a7 refactoring |
6 |
|
707782344 lint; vet |
7 |
// SanitiseString removes characters from s found in patern and returns new modified string. |
b3b60e8b6 string sanitisation |
8 |
func SanitiseString(s string) (safe string) { |
5f1346d2d SQLProtect replac... |
9 |
for _, c := range patern { |
e1fbb41f9 added comments |
10 |
safe = strings.Replace(s, string(c), "", -1) |
5f1346d2d SQLProtect replac... |
11 |
} |
e1fbb41f9 added comments |
12 |
return safe |
5f1346d2d SQLProtect replac... |
13 |
} |