MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / TruncateAt

Function TruncateAt

internal/text/text.go:9–11  ·  view source on GitHub ↗

TruncateAt returns the first n bytes of s. It returns empty string when s is empty or n is less than one.

(s string, n int)

Source from the content-addressed store, hash-verified

7// TruncateAt returns the first n bytes of s.
8// It returns empty string when s is empty or n is less than one.
9func TruncateAt(s string, n int) string {
10 return s[:max(0, min(n, len(s)))]
11}

Callers 2

sanitizeLogDirectoryFunction · 0.92
TestTruncateAtFunction · 0.92

Calls

no outgoing calls

Tested by 1

TestTruncateAtFunction · 0.74