MCPcopy Index your code
hub / github.com/writefreely/writefreely / Truncate

Function Truncate

parse/posts.go:85–91  ·  view source on GitHub ↗

Truncate truncates the given text to the provided limit, returning the original string if it's shorter than the limit.

(s string, l int)

Source from the content-addressed store, hash-verified

83
84// Truncate truncates the given text to the provided limit, returning the original string if it's shorter than the limit.
85func Truncate(s string, l int) string {
86 c := []rune(s)
87 if len(c) > l {
88 s = string(c[:l])
89 }
90 return s
91}

Callers 1

UpdateCollectionMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected