package strings

import "github.com/open-policy-agent/opa/internal/strings"

Package strings contains helpers to perform string manipulation

Index

Functions

func Truncate

func Truncate(str string, maxWidth int) string

func TruncateFilePaths

func TruncateFilePaths(maxIdealWidth, maxWidth int, path ...string) (map[string]string, int)

TruncateFilePaths truncates the given file paths to conform to the given "ideal" width and returns the shortened paths by replacing the middle parts of paths with "...", ex: bundle1/.../a/b/policy.rego

Source Files

strings.go

Version
v1.5.1 (latest)
Published
Jun 4, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
1 day ago

Tools for package owners.