Hello,
I think I may have found something that should make a nice simple way to contribute something small but possibly to this brilliant language.
Go's standard library seems to be missing functions allowing to pad a string with a another string up to a certain number of characters.
I have implemented those for my own purposes but maybe the general public will find those useful too?
I have found those especially useful when implementing sequential numbering that needs to return a certain number of characters, for file names like file_001.txt or dates 2013-02-08.
My implementation looks like that:
func PadRight(s, p string, l int) string
and I was also thinking about writing :
The way they work, they take a string 's' and pad it with 'p' up to the total number of 'l'. PadLeft adds characters on the left, PadRight obviously on the right and Pad could put 's' in the middle and pad it on both sides.
Do you guys think it would be valuable additions to the 'strings' package?
Cheers,
Piotr