mirror of
https://github.com/samber/lo.git
synced 2025-09-26 20:11:13 +08:00
doc: Improve comment for lo.Ellipsis
This commit is contained in:
@@ -210,7 +210,9 @@ func Capitalize(str string) string {
|
||||
return cases.Title(language.English).String(str)
|
||||
}
|
||||
|
||||
// Ellipsis trims and truncates a string to a specified length and appends an ellipsis if truncated.
|
||||
// Ellipsis trims and truncates a string to a specified length **in bytes** and appends an ellipsis
|
||||
// if truncated. If the string contains non-ASCII characters (which may occupy multiple bytes in UTF-8),
|
||||
// truncating by byte length may split a character in the middle, potentially resulting in garbled output.
|
||||
func Ellipsis(str string, length int) string {
|
||||
str = strings.TrimSpace(str)
|
||||
|
||||
|
Reference in New Issue
Block a user