mirror of
https://github.com/wader/fq.git
synced 2024-11-26 10:33:53 +03:00
2c38cf1324
Release notes https://github.com/golangci/golangci-lint/releases/tag/v1.60.1 Require go 1.21 and fix various lint warnings and use new features
10 lines
169 B
Go
10 lines
169 B
Go
package stringsx
|
|
|
|
func TrimN(s string, n int, suffix string) string {
|
|
sl, tl := len(s), len(suffix)
|
|
if sl+tl <= n {
|
|
return s
|
|
}
|
|
return s[0:max(n-tl, 0)] + suffix
|
|
}
|