1
0
Fork 0

stubbed out exercise 7

This commit is contained in:
Stephen M. McQuay 2012-08-28 22:37:55 -06:00
parent 5e38e7bee0
commit b15585364e
1 changed files with 27 additions and 0 deletions

27
exercises/07-rot13/go.go Normal file
View File

@ -0,0 +1,27 @@
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader
}
func (r rot13Reader) Read(p []byte) (n int, err error) {
if len(p) == 0 {
return 0, nil
}
if r.i >= len(r.s) {
return 0, io.EOF
}
return
}
func main() {
s := strings.NewReader("Lbh penpxrq gur pbqr!")
r := rot13Reader{s}
io.Copy(os.Stdout, &r)
}