1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-07 06:02:27 +08:00

feat: add Ellipsis for string

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

View File

@@ -694,3 +694,18 @@ func ExampleConcat() {
// Go Language
// An apple a daykeeps 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...
// 你好...
// 😀😃😄...
}