mirror of
https://github.com/pikami/rss-dl.git
synced 2024-12-02 18:38:25 +00:00
16 lines
261 B
Go
16 lines
261 B
Go
|
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, "_")
|
||
|
}
|