strutil

package
v0.0.0-...-0306ae9 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2018 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FmtDuration

func FmtDuration(dur time.Duration) string

FmtDuration formats a duration according to a specific format

func Len

func Len(s string) (count int)

Len computes the length of a string, but unlike the builtin len, it ignores ANSI escape codes

func ResizeL

func ResizeL(s, post string, l int) string

ResizeL makes sure string is exactly the length of l. If it isn't it will pad spaces at the start as needed or truncate and indicate that via the post string

func ResizeR

func ResizeR(s, post string, l int) string

ResizeR makes sure string is exactly the length of l. If it isn't it will pad spaces at the end as needed or truncate and indicate that via the post string

func Truncate

func Truncate(s string, l int) (string, bool)

Truncate truncates the string s to the given length (ignoring ANSI sequences) and returns the new string. It also returns a boolean based on whether it actually needed to truncate or not

Types

This section is empty.

Jump to

Keyboard shortcuts

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