Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Examples for Toogle #59

Merged
merged 1 commit into from
Nov 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion example_byteslice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,25 @@ func ExampleReverse() {

func ExampleLPad() {
data := []byte{0x55, 0xDA, 0xBA}

fmt.Printf("%x\n", LPad(data, 5, 0x22))
// Output: 222255daba
}

func ExampleToggle() {
data := []byte{0xbb, 0xdb, 0x54}
toggle := []byte{0x01, 0x01, 0x01}

output, _ := Toggle(data, toggle)
fmt.Printf("%x\n", output)
// Output: bada55
}

func ExampleToggle_simple() {
data := []byte{0x00, 0x01, 0x00}
toggle := []byte{0x01, 0x00, 0x01}

output, _ := Toggle(data, toggle)
fmt.Printf("%x\n", output)
// Output: 010101
}