strutil

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package strutil provides various utilities for manipulating strings

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Join

func Join(list []string, delim string) string

Join joins the list of the string with the delim provided. Returns an empty string for empty list

func PadLeft

func PadLeft(str string, length int, pad byte) string

PadLeft returns a new string of a specified length in which the beginning of the current string is padded with spaces or with a specified Unicode character.

func PadRight

func PadRight(str string, length int, pad byte) string

PadRight returns a new string of a specified length in which the end of the current string is padded with spaces or with a specified Unicode character.

func Resize

func Resize(s string, length uint, rightAlign bool) string

Resize resizes the string with the given length. It ellipses with '...' when the string's length exceeds the desired length or pads spaces to the right of the string when length is smaller than desired

func RuneWidth added in v0.0.2

func RuneWidth(s rune) int

RuneWidth returns the actual width of the rune

func StringWidth added in v0.0.2

func StringWidth(s string) int

StringWidth returns the actual width of the string without colors

func Strip added in v0.0.2

func Strip(s string) string

Strip strips the string of all colors

Types

This section is empty.

Jump to

Keyboard shortcuts

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