pad

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: MIT Imports: 3 Imported by: 7

README

pad

shortcuts for padding strings

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Indent added in v0.0.3

func Indent(s string, nspaces int) string

Indent splits the given string by \n and prefix each line with the given amount of spaces

func IndentAndTrim added in v0.0.3

func IndentAndTrim(s string, nspaces int) string

IndentAndTrim is like Indent but any previous leading (left) spaces are removed.

func Pad

func Pad(s string, width int) string

Pad (left-) pads the given string to the given target width with spaces

func PadWidth added in v0.0.2

func PadWidth(s string, width int) int

PadWidth returns the number of runes that were added for padding

func PadWith added in v0.0.2

func PadWith(s string, with rune, width int) string

PadWith acts like Pad but paddings with the given rune instead of a space

func Repeat

func Repeat(s string, n int) string

Repeat repeats the given string n times

func RightPad added in v0.0.2

func RightPad(s string, width int) string

RightPad right-pads the given string to the given target width with spaces

func RightPadWith added in v0.0.2

func RightPadWith(s string, with rune, width int) string

RightPadWith acts like RightPad but paddings with the given rune instead of a space

func Width

func Width(s string) int

Width returns the number of runes in the 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