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.
|
|
|
package stringx
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
"unicode"
|
|
|
|
)
|
|
|
|
|
|
|
|
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 ""
|
|
|
|
}
|
|
|
|
func IsFirstUpper(name string) bool {
|
|
|
|
for a, b := range name {
|
|
|
|
if a == 0 && string(b) == strings.ToUpper(string(b)) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
break
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|