+ BuildWhitelistForStringSanitisation

This commit is contained in:
Andreas Schulte 2023-10-07 15:56:10 +02:00
parent 9c4d3c851c
commit 68f6576663
Signed by: andreas
GPG Key ID: DCD1B6A247B69DB6

View File

@ -6,6 +6,18 @@ import (
"strings" "strings"
) )
// BuildWhitelistForStringSanitisation transfroms a slice of whitelisted substrings into a hashtable
func BuildWhitelistForStringSanitisation(wl []string) map[string]string {
whitelist := map[string]string{}
for _, c := range wl {
whitelist[c] = c
}
return whitelist
}
// FirstCharacterToUppercase converts the first character of a string to uppercase // FirstCharacterToUppercase converts the first character of a string to uppercase
func FirstCharacterToUppercase(s string) string { func FirstCharacterToUppercase(s string) string {
if len(s) == 0 { if len(s) == 0 {