You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
465 B

1 year ago
package stringx
1 year ago
import (
"strings"
"unicode"
)
1 year ago
func Ucfirst(str string) string {
for i, v := range str {
return string(unicode.ToUpper(v)) + str[i+1:]
}
return ""
}
func Lcfirst(str string) string {
for i, v := range str {
return string(unicode.ToLower(v)) + str[i+1:]
}
return ""
}
1 year ago
func IsFirstUpper(name string) bool {
for a, b := range name {
if a == 0 && string(b) == strings.ToUpper(string(b)) {
return true
}
break
}
return false
}