MCPcopy
hub / github.com/jesseduffield/lazygit / LimitStr

Function LimitStr

pkg/utils/slice.go:69–78  ·  view source on GitHub ↗
(value string, limit int)

Source from the content-addressed store, hash-verified

67}
68
69func LimitStr(value string, limit int) string {
70 n := 0
71 for i := range value {
72 if n >= limit {
73 return value[:i]
74 }
75 n++
76 }
77 return value
78}
79
80// Similar to a regular GroupBy, except that each item can be grouped under multiple keys,
81// so the callback returns a slice of keys instead of just one key.

Callers 2

getInitialsFunction · 0.92
TestLimitStrFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestLimitStrFunction · 0.68