xstrings

package
v0.76.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package xstrings provides helpers for strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareIgnoreCase

func CompareIgnoreCase(a, b string) int

CompareIgnoreCase works like strings.Compare, but is case insensitive.

func JoinsOrEmpty

func JoinsOrEmpty(elems []string, sep, empty string) string

JoinsOrEmpty joins strings together like strings.Join, but returns a fallback when the elem slice is empty.

func Obfuscate added in v0.62.1

func Obfuscate(s string, n int, placeholder rune) string

Obfuscate returns a new string of the same length as s with all characters replaced with a placeholder, except for the last n characters.

func RemoveMultiByte added in v0.70.0

func RemoveMultiByte(s string) string

RemoveMultiByte returns a new string where all multi-byte UTF-8 characters have been removed.

func SanitizeFilename added in v0.72.0

func SanitizeFilename(s string) string

SanitizeFilename returns a copy of s usable as a file name on Windows, Unix, macOS and Android. Returns "_" if nothing usable remains.

func Title

func Title(s string) string

Title returns a string with the first letter of every word upper cased.

func TruncateWithSuffix added in v0.68.0

func TruncateWithSuffix(s string, limit int, suffixLen int) string

TruncateWithSuffix shortens the length of s to limit amount of characters and adds an ellipsis when the string was shortened. It can optionally keep suffixLen characters at the end.

Types

This section is empty.

Jump to

Keyboard shortcuts

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