From e0bbe43401fc5409184b8b584ea90235caf2b81a Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Tue, 10 Jul 2018 21:01:30 -0700 Subject: [PATCH] utf8s.RuneScanner docs --- README.md | 16 ++++++++++++++++ doc.go | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/README.md b/README.md index 83eade1..4c45b9c 100644 --- a/README.md +++ b/README.md @@ -43,3 +43,19 @@ runeReader := utf8s.NewRuneReader(reader) r, n, err := runeReader.ReadRune() ``` + +```go +var reader io.Reader + +// ... + +runeScanner := utf8s.NewRuneScanner(reader) + +// ... + +r, n, err := runeScanner.ReadRune() + +// ... + +err = runeScanner.UnreadRune() +``` diff --git a/doc.go b/doc.go index 5d27868..5b52b7f 100644 --- a/doc.go +++ b/doc.go @@ -37,6 +37,23 @@ Example r, n, err := runeReader.ReadRune() +Example + + var reader io.Reader + + // ... + + runeScanner := utf8s.NewRuneScanner(reader) + + // ... + + r, n, err := runeScanner.ReadRune() + + // ... + + err = runeScanner.UnreadRune() + + Example var r rune