MCPcopy Index your code
hub / github.com/conventionalcommit/commitlint / IsPascalCase

Function IsPascalCase

internal/casing/casing.go:90–104  ·  view source on GitHub ↗

IsPascalCase reports whether s is in PascalCase format. PascalCase: starts with an uppercase letter and contains only letters and digits (no separators). Examples: "MyFeature", "ParseHTML", "Feat".

(s string)

Source from the content-addressed store, hash-verified

88// PascalCase: starts with an uppercase letter and contains only letters and
89// digits (no separators). Examples: "MyFeature", "ParseHTML", "Feat".
90func IsPascalCase(s string) bool {
91 if s == "" {
92 return true
93 }
94 runes := []rune(s)
95 if !unicode.IsUpper(runes[0]) {
96 return false
97 }
98 for _, r := range runes {
99 if !unicode.IsLetter(r) && !unicode.IsDigit(r) {
100 return false
101 }
102 }
103 return true
104}
105
106// IsSentenceCase reports whether s is in Sentence case format.
107// Sentence case: first rune is uppercase; every subsequent letter is lowercase.

Callers 2

TestIsPascalCaseFunction · 0.92
CheckFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestIsPascalCaseFunction · 0.74