stringutil

package
v0.34.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package stringutil provides utility functions for working with strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeWhitespace

func NormalizeWhitespace(content string) string

NormalizeWhitespace normalizes trailing whitespace and newlines to reduce spurious conflicts. It trims trailing whitespace from each line and ensures exactly one trailing newline.

func ParseVersionValue

func ParseVersionValue(version any) string

ParseVersionValue converts version values of various types to strings. Supports string, int, int64, uint64, and float64 types. Returns empty string for unsupported types.

func SanitizeErrorMessage

func SanitizeErrorMessage(message string) string

SanitizeErrorMessage removes potential secret key names from error messages to prevent information disclosure via logs. This prevents exposing details about an organization's security infrastructure by redacting secret key names that might appear in error messages.

func Truncate

func Truncate(s string, maxLen int) string

Truncate truncates a string to a maximum length, adding "..." if truncated. If maxLen is 3 or less, the string is truncated without "...".

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL