Categorygithub.com/willf/pad
repositorypackage
0.0.0-20200313202418-172aa767f2a4
Repository: https://github.com/willf/pad.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

pad

Join the chat at https://gitter.im/willf/pad

Build Status

A golang implementation of the left-pad javascript library

I was inspired by Stew's left-cats, who was inspired by this article, to port this to Go.

This implementation will let you pad byte-strings and UTF-8 encoded strings

example usage:

package main

import (
	"fmt"

	"github.com/willf/pad"
	padUtf8 "github.com/willf/pad/utf8"
)

func main() {
	fmt.Println(pad.Right("Hello", 20, "!"))
	fmt.Println(padUtf8.Left("Exit now", 20, "→"))
}
> go run example.go
Hello!!!!!!!!!!!!!!!
→→→→→→→→→→→→Exit now