This commit is contained in:
12600k-rog-d4
2025-12-09 20:33:57 +08:00
parent 144ed3cbdf
commit 8f4d399cfd
1498 changed files with 3778 additions and 3654 deletions

View File

@@ -0,0 +1,17 @@
package text
import (
"strings"
"github.com/mlogclub/simple/common/strs"
)
// GetSummary 获取summary
func GetSummary(s string, length int) string {
s = strings.TrimSpace(s)
summary := strs.Substr(s, 0, length)
if strs.RuneLen(s) > length {
summary += "..."
}
return summary
}