Skip to content

keltia/leftpad

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

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).

Build status

Branch: master — master|Build Status

Install

go get github.com/keltia/leftpad 

Usage

GoDoc

import "github.com/keltia/leftpad"

leftpad.Pad("foo", 5)    // "  foo"
leftpad.Pad("foobar", 8) // "  foobar"
leftpad.Pad("foobar", 6) // "foobar"

leftpad.PadChar("foo", 5, 'X') // "XXfoo"

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages