toSnakeCase converts the provided string to snake_case. Based on https://gist.github.com/stoewer/fbe273b711e6a06315d19552dd4d33e6
(input string)
| 303 | // toSnakeCase converts the provided string to snake_case. |
| 304 | // Based on https://gist.github.com/stoewer/fbe273b711e6a06315d19552dd4d33e6 |
| 305 | func toSnakeCase(input string) string { |
| 306 | output := rxMatchFirstCap.ReplaceAllString(input, "${1}_${2}") |
| 307 | output = rxMatchAllCap.ReplaceAllString(output, "${1}_${2}") |
| 308 | output = strings.ReplaceAll(output, "-", "_") |
| 309 | return strings.ToLower(output) |
| 310 | } |
no outgoing calls
no test coverage detected