1
1
mirror of https://github.com/wader/fq.git synced 2024-11-26 10:33:53 +03:00
fq/internal/stringsx/stringsx.go
bump 2c38cf1324 Update github-golangci-lint to 1.60.1 from 1.59.1
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
2024-08-14 20:05:40 +02:00

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
}