ToSnake converts the input text into snake case
()
| 74 | |
| 75 | // ToSnake converts the input text into snake case |
| 76 | func (s String) ToSnake() string { |
| 77 | list := s.splitBy(unicode.IsUpper, false) |
| 78 | var target []string |
| 79 | for _, item := range list { |
| 80 | target = append(target, From(item).Lower()) |
| 81 | } |
| 82 | return strings.Join(target, "_") |
| 83 | } |
| 84 | |
| 85 | // Untitle return the original string if rune is not letter at index 0 |
| 86 | func (s String) Untitle() string { |