1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

doc: add doc for Pad function

This commit is contained in:
dudaodong
2023-02-19 12:58:14 +08:00
parent 8784be1583
commit fee8d325b7
3 changed files with 119 additions and 1 deletions

View File

@@ -186,6 +186,33 @@ func ExampleUpperFirst() {
// Bar大
}
func ExamplePad() {
result1 := Pad("foo", 1, "bar")
result2 := Pad("foo", 2, "bar")
result3 := Pad("foo", 3, "bar")
result4 := Pad("foo", 4, "bar")
result5 := Pad("foo", 5, "bar")
result6 := Pad("foo", 6, "bar")
result7 := Pad("foo", 7, "bar")
fmt.Println(result1)
fmt.Println(result2)
fmt.Println(result3)
fmt.Println(result4)
fmt.Println(result5)
fmt.Println(result6)
fmt.Println(result7)
// Output:
// foo
// foo
// foo
// foob
// bfoob
// bfooba
// bafooba
}
func ExamplePadEnd() {
result1 := PadEnd("foo", 1, "bar")
result2 := PadEnd("foo", 2, "bar")