utils

package
v0.5.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Truncate

func Truncate(s string, maxLen int) string

Truncate 按 rune 安全截断字符串到 maxLen 个字符(rune),超出则追加 "..."。 使用 rune 计数避免切断多字节 UTF-8 字符(如中文)产生无效 UTF-8。

func TruncateDetailed

func TruncateDetailed(s string, maxLen int) string

TruncateDetailed 按 rune 安全截断,并在末尾标注总字符数。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL