strutil

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ellipsis added in v0.13.0

func Ellipsis(str string, threshold int) string

Ellipsis returns a truncated string and appends "..." to the end of the string if the string length is larger than the threshold. Otherwise, the original string is returned.

func RandomChars

func RandomChars(n int) (string, error)

RandomChars returns a generated string in given number of random characters.

func ToUpperFirst

func ToUpperFirst(s string) string

ToUpperFirst returns s with only the first Unicode letter mapped to its upper case.

func Truncate added in v0.13.0

func Truncate(str string, limit int) string

Truncate returns a truncated string if its length is over the limit. Otherwise, it returns the original string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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