Пример #1
0
// ToLowerAbridge extract first letter and all upper case letter
// from string as it's abridge case, and convert it to lower case
func ToLowerAbridge(str string) (s string) {
	l := len(str)
	if l == 0 {
		return ""
	}

	arbi := []byte{unibyte.ToLower(str[0])}
	for i := 1; i < l; i++ {
		b := str[i]
		if unibyte.IsUpper(b) {
			arbi = append(arbi, unibyte.ToLower(b))
		}
	}

	return string(arbi)
}
Пример #2
0
// ToAbridge extract first letter and all upper case letter
// from string as it's abridge case
func ToAbridge(str string) string {
	l := len(str)
	if l == 0 {
		return ""
	}

	arbi := []byte{str[0]}
	for i := 1; i < l; i++ {
		b := str[i]
		if unibyte.IsUpper(b) {
			arbi = append(arbi, b)
		}
	}

	return string(arbi)
}