Initial commit

This commit is contained in:
Pijus Kamandulis
2019-04-17 22:26:44 +03:00
commit 07a977f4c8
6 changed files with 200 additions and 0 deletions

15
helpers/string_methods.go Normal file
View File

@@ -0,0 +1,15 @@
package helpers
import (
"log"
"regexp"
)
// ToCleanString - replaces spaces with underscores
func ToCleanString(str string) string {
reg, err := regexp.Compile("[^A-Za-z0-9]+")
if err != nil {
log.Fatal(err)
}
return reg.ReplaceAllString(str, "_")
}