コード例 #1
0
ファイル: StructMethExtend.go プロジェクト: suntong/lang
func test1() {
	Replace := shaper.NewFilter().ApplyReplace("test", "biscuit", -1)
	// Add stages later on
	Replace.ApplyToUpper()

	// Demonstrating copy
	Extra := Replace.Copy()
	// The copy has everything Replace had (note the change to Testificate.)
	Extra.ApplyReplace("THIS", "THAT", -1)
	fmt.Printf("%s\n", Extra.Process("This is also a test. Testificate."))
	fmt.Print("^^^^\n")
	// but Replace still has the old original effect.
	fmt.Printf("%s\n", Replace.Process("This is also a test. Testificate."))
	fmt.Print("^^^^\n")
}
コード例 #2
0
ファイル: StructMethExtend.go プロジェクト: suntong/lang
// Make a new Shaper filter and start adding bits
func NewFilter() *Shaper {
	return &Shaper{Shaper: shaper.NewFilter()}
}