func RatioUpperLower(text string) float64 {
	if len(text) == 0 {
		return 0
	}
	up, lo := CountUpperLower(text)
	if lo == 0 {
		return float64(up)
	}
	return float64(up) / float64(lo)
}
RatioUpperLower compute and return ratio of uppercase with lowercase
character in text.
package strings
import (
	"strings"
	"unicode"
	"github.com/shuLhan/share/lib/ints"
	"github.com/shuLhan/share/lib/runes"
)
func CountAlnum(text string) (n int) {
	if len(text) == 0 {
		return
	}
	for _, v := range text {
		if unicode.IsDigit(v) || unicode.IsLetter(v) {
			n++
		}
	}
	return
}
func CountAlnumDistribution(text string) (chars []rune, counts []int) {
	var found bool
	for _, v := range text {
		if !(unicode.IsDigit(v) || unicode.IsLetter(v)) {
			continue
		}
		found = false
		for y, c := range chars {
			if v == c {
				counts[y]++
				found = true
				break
			}
		}
		if !found {
			chars = append(chars, v)
			counts = append(counts, 1)
		}
	}
	return
}
func CountCharSequence(text string) (chars []rune, counts []int) {
	var lastv rune
	count := 1
	for _, v := range text {
		if v == lastv {
			if !unicode.IsSpace(v) {
				count++
			}
		} else {
			if count > 1 {
				chars = append(chars, lastv)
				counts = append(counts, count)
				count = 1
			}
		}
		lastv = v
	}
	if count > 1 {
		chars = append(chars, lastv)
		counts = append(counts, count)
	}
	return
}
func CountDigit(text string) (n int) {
	if len(text) == 0 {
		return 0
	}
	for _, v := range text {
		if unicode.IsDigit(v) {
			n++
		}
	}
	return
}
func CountNonAlnum(text string, withspace bool) (n int) {
	if len(text) == 0 {
		return
	}
	for _, v := range text {
		if unicode.IsDigit(v) || unicode.IsLetter(v) {
			continue
		}
		if unicode.IsSpace(v) {
			if withspace {
				n++
			}
			continue
		}
		n++
	}
	return
}
func CountUniqChar(text string) (n int) {
	if len(text) == 0 {
		return
	}
	uchars := make([]rune, 0, len(text))
	for _, v := range text {
		yes, _ := runes.Contain(uchars, v)
		if yes {
			continue
		}
		uchars = append(uchars, v)
		n++
	}
	return
}
func CountUpperLower(text string) (upper, lower int) {
	for _, v := range text {
		if !unicode.IsLetter(v) {
			continue
		}
		if unicode.IsUpper(v) {
			upper++
		} else {
			lower++
		}
	}
	return
}
func MaxCharSequence(text string) (rune, int) {
	if len(text) == 0 {
		return 0, 0
	}
	chars, counts := CountCharSequence(text)
	if len(chars) == 0 {
		return 0, 0
	}
	_, idx, _ := ints.Max(counts)
	return chars[idx], counts[idx]
}
func RatioAlnum(text string) float64 {
	textlen := len(text)
	if textlen == 0 {
		return 0
	}
	n := CountAlnum(text)
	return float64(n) / float64(textlen)
}
func RatioDigit(text string) float64 {
	textlen := len(text)
	if textlen == 0 {
		return 0
	}
	n := CountDigit(text)
	if n == 0 {
		return 0
	}
	return float64(n) / float64(textlen)
}
func RatioUpper(text string) float64 {
	if len(text) == 0 {
		return 0
	}
	up, lo := CountUpperLower(text)
	total := up + lo
	if total == 0 {
		return 0
	}
	return float64(up) / float64(total)
}
func RatioNonAlnum(text string, withspace bool) float64 {
	textlen := len(text)
	if textlen == 0 {
		return 0
	}
	n := CountNonAlnum(text, withspace)
	return float64(n) / float64(textlen)
}