The io package has the RuneReader interface.

You can wrap a generic io.Reader in a bufio.Reader
or if you already have a string or byte slice, you can use
strings.Reader or bytes.Reader respectively, to get a RuneReader.

On Saturday, November 5, 2016 at 10:40:34 PM UTC-7, so.q...@gmail.com wrote:
>
> Just a thought experiment, but what's the idiomatic way to read 
> rune-by-rune from a stream that represents a string of infinite length? The 
> stream itself can be from std.In or continually generated by a function.
>
> Would I use bufio.Scanner or bufio.Reader? I suppose its also possible to 
> use a channel.
>
> Also, is it correct for me to say that bufio.Reader is more primitive than 
> bufio.Scanner. Its not clear to me their relative purposes.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to