Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeduplicateStrings ¶ added in v0.1.19
DeduplicateStrings returns a new slice with whitespace-trimmed, empty, and duplicate entries removed from input. When sorted is true the result is sorted in ascending order. The relative order of first-seen entries is preserved when sorted is false.
func RandomHex ¶ added in v0.2.18
RandomHex returns a hex-encoded string of n cryptographically random bytes. The returned string has length 2*n.
func Truncate ¶
Truncate truncates a string to the specified maximum length. If the string is longer than maxLen, it's truncated and "..." is appended. If maxLen is 0, returns "..." for non-empty strings, empty string for empty strings. If maxLen is negative, the original string is returned.
func TruncateRunes ¶ added in v0.2.18
TruncateRunes truncates s to at most maxRunes Unicode code points (runes). Unlike Truncate, which counts bytes, TruncateRunes is safe for non-ASCII content (e.g. emoji, CJK characters). If maxRunes is 0 or negative, returns an empty string.
func TruncateWithSuffix ¶
TruncateWithSuffix truncates a string to the specified maximum length with a custom suffix. If the string is longer than maxLen, it's truncated and suffix is appended. If maxLen is 0 or negative, the original string is returned.
Types ¶
This section is empty.