We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f1dce8f commit 52ad90cCopy full SHA for 52ad90c
string.go
@@ -210,7 +210,9 @@ func Capitalize(str string) string {
210
return cases.Title(language.English).String(str)
211
}
212
213
-// 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
214
+// if truncated. If the string contains non-ASCII characters (which may occupy multiple bytes in UTF-8),
215
+// truncating by byte length may split a character in the middle, potentially resulting in garbled output.
216
func Ellipsis(str string, length int) string {
217
str = strings.TrimSpace(str)
218
0 commit comments