MCPcopy Index your code
hub / github.com/coder/coder / truncateRunes

Function truncateRunes

coderd/exp_chats.go:6332–6343  ·  view source on GitHub ↗
(value string, maxLen int)

Source from the content-addressed store, hash-verified

6330}
6331
6332func truncateRunes(value string, maxLen int) string {
6333 if maxLen <= 0 {
6334 return ""
6335 }
6336
6337 runes := []rune(value)
6338 if len(runes) <= maxLen {
6339 return value
6340 }
6341
6342 return string(runes[:maxLen])
6343}
6344
6345// linkFilesToChat inserts file-link rows into the chat_file_links
6346// join table. Cap enforcement and dedup are handled atomically in

Callers 1

chatTitleFromMessageFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected