str

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: BSD-3-Clause Imports: 3 Imported by: 1

Documentation

Overview

Utility to manipulate string.

Index

Constants

View Source
const Empty = ""

Represents the emptry string.

Variables

This section is empty.

Functions

func Contact

func Contact(sources ...any) string

Contact the sources from any type.

func Format

func Format(source string, name string, value any) string

Format source string that instead given name in curly brackets by given value.

Example:

Format("abc {name}", "name", 1) -> "abc 1"

func Formats

func Formats(source string, params map[string]any) string

Format source string by calling Format functon. See also Format.

func From

func From(value any) string

Convert to string from any type.

func IsEmpty

func IsEmpty(source string) bool

Identify whether the source string is empty.

func IsNotEmpty

func IsNotEmpty(source string) bool

Identify whether the source string is not empty.

func PadLeft added in v0.1.1

func PadLeft(s, pad string, length int) string

PadLeft a string.

func PadRight added in v0.1.1

func PadRight(s, pad string, length int) string

PadRight a string.

func Padding added in v0.1.1

func Padding(s, pad string, length int, isRight bool) string

Padding a string.

func RepeatBytes added in v0.1.1

func RepeatBytes(char byte, times int) (chars []byte)

RepeatBytes repeat a byte char.

func RepeatRune added in v0.1.1

func RepeatRune(char rune, count int) (chars []rune)

RepeatRune repeat a rune char.

func WrapTag added in v0.1.1

func WrapTag(s, tag string) string

WrapTag for given string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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