stringsExt

package
v0.0.0-...-f277093 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package strings extends the functionality of the standard strings library

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capitalize

func Capitalize(s string) string

Capitalize returns the string with the first character converted to uppercase

func ContainsAll

func ContainsAll(s string, substrings ...string) bool

ContainsAll returns true if the string contains all of the specified substrings

func ContainsAny

func ContainsAny(s string, substrings ...string) bool

ContainsAny returns true if the string contains any of the specified substrings

func DefaultIfBlank

func DefaultIfBlank(s string, defaultValue string) string

DefaultIfBlank returns the default value if the string is blank

func DefaultIfEmpty

func DefaultIfEmpty(s string, defaultValue string) string

DefaultIfEmpty returns the default value if the string is empty

func IsAlpha

func IsAlpha(s string) bool

IsAlpha returns true if the string contains only Unicode letters

func IsAlphanumeric

func IsAlphanumeric(s string) bool

IsAlphanumeric returns true if the string contains only Unicode letters or digits

func IsBlank

func IsBlank(s string) bool

IsBlank returns true if the string is empty or only contains whitespace

func IsEmpty

func IsEmpty(s string) bool

IsEmpty returns true if the string is empty

func IsNumeric

func IsNumeric(s string) bool

IsNumeric returns true if the string contains only Unicode digits

func LeftPad

func LeftPad(s string, width int, char rune) string

LeftPad pads the string on the left with the specified char to the given width

func Reverse

func Reverse(s string) string

Reverse returns the string with its characters in reverse order

func RightPad

func RightPad(s string, width int, char rune) string

RightPad pads the string on the right with the specified char to the given width

func SwapCase

func SwapCase(s string) string

SwapCase returns the string with uppercase changed to lowercase and vice versa

func TruncateWithSuffix

func TruncateWithSuffix(s string, maxLength int, suffix string) string

TruncateWithSuffix truncates a string to the specified length and appends the suffix

func Uncapitalize

func Uncapitalize(s string) string

Uncapitalize returns the string with the first character converted to lowercase

Types

This section is empty.

Jump to

Keyboard shortcuts

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