IsSnakeCase reports whether s is in snake_case format. snake_case: only lowercase letters, digits, and underscores. Examples: "my_feature", "snake_case", "v2_api".
(s string)
| 127 | // snake_case: only lowercase letters, digits, and underscores. |
| 128 | // Examples: "my_feature", "snake_case", "v2_api". |
| 129 | func IsSnakeCase(s string) bool { |
| 130 | for _, r := range s { |
| 131 | if !unicode.IsLower(r) && !unicode.IsDigit(r) && r != '_' { |
| 132 | return false |
| 133 | } |
| 134 | } |
| 135 | return true |
| 136 | } |
| 137 | |
| 138 | // IsStartCase reports whether s is in Start Case format. |
| 139 | // Start Case: every whitespace-separated word starts with an uppercase letter. |
no outgoing calls