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.4.2 (latest)
Published
May 2, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
6 hours ago

Tools for package owners.