github.com/nordicdyno/leftpad

Go implementation of the "left-pad" package, inspired by the NPM package of the same [in]famous name.


License
BSD-2-Clause
Install
go get github.com/nordicdyno/leftpad

Documentation

left-pad

Go package to left pad a string with a character.

Inspired by the "left-pad" NPM package (and the fiasco that happened after its removal).

Install

go get github.com/keltia/leftpad 

Usage

import 'github.com/keltia/leftpad'

leftpad.LeftPad("foo", 5)       # => "  foo"
leftpad.LeftPad("foobar", 8)    # => "  foobar"
leftpad.LeftPad("foobar", 6)    # => "foobar"

leftpad.LeftPadStr("foo", 5, "X") # => "XXfoo"