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

38 lines
740 B
Go
Raw Normal View History

2017-10-03 21:43:55 +03:00
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"
}