1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
package caesar import ( "fmt" ) func ExampleEncode() { secret := Encode("attack at dawn") fmt.Println(secret) // Output: dwwdfn dw gdzq } func ExampleCoder() { c := Coder{ Key: 5, Ranges: []RuneRange{ {Start: 'A', End: 'Z'}, }, } fmt.Println(c.Encode("aAbBcCdD")) // Output: aFbGcHdI }