WIP: Refactor

This commit is contained in:
2026-05-10 23:31:10 +02:00
parent dedbcc4cfe
commit f50004d9b4
16 changed files with 897 additions and 585 deletions
+21
View File
@@ -0,0 +1,21 @@
package util
import (
"strings"
"unicode"
)
func CamelToSnake(str string) string {
var snake strings.Builder
isPrevUpper := true
for _, c := range str {
if unicode.IsUpper(c) && !isPrevUpper {
snake.WriteString("_" + string(unicode.ToUpper(c)))
isPrevUpper = true
} else {
snake.WriteString(string(unicode.ToUpper(c)))
isPrevUpper = unicode.IsUpper(c)
}
}
return snake.String()
}