Commit b3b60e8b60f38b2e709ae0b0dd1ae5686afdcc63
1 parent
8bc396eb96
Exists in
master
and in
1 other branch
string sanitisation
Showing
2 changed files
with
13 additions
and
13 deletions
Show diff stats
sql_sequrity.go
1 | package webutility | File was deleted | |
2 | |||
3 | import "strings" | ||
4 | |||
5 | var patern string = "\"';&*<>=\\`:" | ||
6 | |||
7 | // SQLSafeString removes characters from s found in patern and returns new modified string. | ||
8 | func SQLSafeString(s string) (safe string) { | ||
9 | for _, c := range patern { | ||
10 | safe = strings.Replace(s, string(c), "", -1) | ||
11 | } | ||
12 | return safe | ||
13 | } | ||
14 | 1 | package webutility |
string_sanitisation.go
File was created | 1 | package webutility | |
2 | |||
3 | import "strings" | ||
4 | |||
5 | var patern string = "\"';&*<>=\\`:" | ||
6 | |||
7 | // SQLSafeString removes characters from s found in patern and returns new modified string. | ||
8 | func SanitiseString(s string) (safe string) { | ||
9 | for _, c := range patern { | ||
10 | safe = strings.Replace(s, string(c), "", -1) | ||
11 | } | ||
12 | return safe | ||
13 | } | ||
14 |