1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
cowyo/vendor/github.com/shurcooL/go/trim/trim_test.go
2017-10-03 14:43:55 -04:00

38 lines
740 B
Go

package trim_test
import (
"fmt"
"github.com/shurcooL/go/trim"
)
func ExampleLastNewline() {
fmt.Printf("%q\n", trim.LastNewline("String\n"))
fmt.Printf("%q\n", trim.LastNewline("String"))
fmt.Printf("%q\n", trim.LastNewline("\n"))
fmt.Printf("%q\n", trim.LastNewline(""))
fmt.Printf("%q\n", trim.LastNewline(" String\n\n"))
// Output:
// "String"
// "String"
// ""
// ""
// " String\n"
}
func ExampleFirstSpace() {
fmt.Printf("%q\n", trim.FirstSpace(" String"))
fmt.Printf("%q\n", trim.FirstSpace("String"))
fmt.Printf("%q\n", trim.FirstSpace(" "))
fmt.Printf("%q\n", trim.FirstSpace(""))
fmt.Printf("%q\n", trim.FirstSpace(" String\n\n"))
// Output:
// "String"
// "String"
// ""
// ""
// " String\n\n"
}