add: leetcode 0520 solution

This commit is contained in:
tphyhFighting
2021-11-13 20:44:39 +08:00
parent df54373ba8
commit 761469af16

View File

@ -0,0 +1,13 @@
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
}