PadEnd
Overview
PadEnd pads s on the right to length with pad (String.padEnd).
If you are coming from Node.js, the closest pattern is s.padEnd(n, ch).
Signature
go
func PadEnd(s string, length int, pad string) stringCompare: Node.js · Standard Go · gox
js
s.padEnd(8, '-');go
s = fmt.Sprintf("%*s", width, s) // or custom paddinggo
import "github.com/sahilkhaire/gox/str"
s := str.PadEnd("go", 8, "-")Example
go
import "github.com/sahilkhaire/gox/str"
s := str.PadEnd("go", 8, "-")Tips
Import github.com/sahilkhaire/gox/str and call PadEnd directly. See the comparison below for the standard library equivalent.
Standard library alternative
Use the standard library directly:
go
s = fmt.Sprintf("%*s", width, s) // or custom padding