IsKebabCase reports whether s is in kebab-case format. kebab-case: only lowercase letters, digits, and hyphens. Examples: "my-feature", "kebab-case", "v2-api".
(s string)
| 76 | // kebab-case: only lowercase letters, digits, and hyphens. |
| 77 | // Examples: "my-feature", "kebab-case", "v2-api". |
| 78 | func IsKebabCase(s string) bool { |
| 79 | for _, r := range s { |
| 80 | if !unicode.IsLower(r) && !unicode.IsDigit(r) && r != '-' { |
| 81 | return false |
| 82 | } |
| 83 | } |
| 84 | return true |
| 85 | } |
| 86 | |
| 87 | // IsPascalCase reports whether s is in PascalCase format. |
| 88 | // PascalCase: starts with an uppercase letter and contains only letters and |
no outgoing calls