stringutil

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package stringutil provides common string manipulation utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Truncate

func Truncate(s string, maxLen int) string

Truncate truncates a string to maxLen characters and adds "..." if truncated. If the string is shorter than or equal to maxLen, it returns the original string.

func TruncateMiddle

func TruncateMiddle(s string, maxLen int) string

TruncateMiddle truncates a string in the middle, preserving the beginning and end. This is useful for URLs where both the domain and the endpoint are important. Example: "https://api.example.com/v1/users/12345" -> "https://api.example...rs/12345"

Types

This section is empty.

Jump to

Keyboard shortcuts

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