feat: add Ellipsis for string

This commit is contained in:
dudaodong committed 2024-09-03 14:36:12 +08:00
1 parent 9824db0056
commit 71e914019b
5 files changed
+140 -12

No files matched your search

+15
View File
@@ -694,3 +694,18 @@ func ExampleConcat() {
// Go Language
// An apple a day,keeps the doctor away
}
func ExampleEllipsis() {
result1 := Ellipsis("hello world", 5)
result2 := Ellipsis("你好,世界!", 2)
result3 := Ellipsis("😀😃😄😁😆", 3)
fmt.Println(result1)
fmt.Println(result2)
fmt.Println(result3)
// Output:
// hello...
// 你好...
// 😀😃😄...
}