docs: Add a more precise description to the Ellipsis function to prevent misunderstanding. (#635)

Signed-off-by: mengxun <mengxun1122@163.com>
This commit is contained in:
mengxun
2025-05-22 19:12:10 +08:00
committed by GitHub
parent a9a589c4d5
commit f1dce8f5e7

View File

@@ -1771,7 +1771,7 @@ str := lo.Capitalize("heLLO")
### Ellipsis
Trims and truncates a string to a specified length and appends an ellipsis if truncated.
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.
```go
str := lo.Ellipsis(" Lorem Ipsum ", 5)