Skip to content

willf/pad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Left and Right padding of strings for Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages