mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-06 01:15:57 +08:00
14 lines
318 B
Go
14 lines
318 B
Go
package leetcode
|
|
|
|
import "strings"
|
|
|
|
func detectCapitalUse(word string) bool {
|
|
wLower := strings.ToLower(word)
|
|
wUpper := strings.ToUpper(word)
|
|
wCaptial := strings.ToUpper(string(word[0])) + strings.ToLower(string(word[1:]))
|
|
if wCaptial == word || wLower == word || wUpper == word {
|
|
return true
|
|
}
|
|
return false
|
|
}
|