package utils

import "strings"

// CleanString 移除所有空白字符
func CleanString(s string) string {
	fields := strings.Fields(s)
	return strings.Join(fields, "")
}

func TruncateString(s string, maxLen int) string {
	if maxLen <= 0 {
		return ""
	}
	runes := []rune(s)
	if len(runes) <= maxLen {
		return s
	}
	return string(runes[:maxLen])
}
