strutil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2017 License: MIT Imports: 2 Imported by: 91

Documentation

Overview

Package strutil provides various utilities for manipulating strings

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 PrettyTime

func PrettyTime(t time.Duration) string

PrettyTime returns the string representation of the duration. It rounds the time duration to a second and returns a "---" when duration is 0

func Resize

func Resize(s string, length uint) 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

Types

This section is empty.

Jump to

Keyboard shortcuts

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