mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-08 14:42:27 +08:00
feat: add Pad function
This commit is contained in:
@@ -67,6 +67,13 @@ func LowerFirst(s string) string {
|
||||
return string(r) + s[size:]
|
||||
}
|
||||
|
||||
// PadStart pads string on the left and right side if it's shorter than size.
|
||||
// Padding characters are truncated if they exceed size.
|
||||
// Play: todo
|
||||
func Pad(source string, size int, padStr string) string {
|
||||
return padAtPosition(source, size, padStr, 0)
|
||||
}
|
||||
|
||||
// PadStart pads string on the left side if it's shorter than size.
|
||||
// Padding characters are truncated if they exceed size.
|
||||
// Play: https://go.dev/play/p/xpTfzArDfvT
|
||||
|
||||
Reference in New Issue
Block a user