34 lines
558 B
Go
34 lines
558 B
Go
package bufr
|
|
|
|
import (
|
|
"bufio"
|
|
"io"
|
|
"strings"
|
|
)
|
|
|
|
func prependString(str string, r io.Reader) *bufio.Reader {
|
|
return bufio.NewReader(io.MultiReader(strings.NewReader(str), r))
|
|
}
|
|
|
|
func prependRune(rn rune, r io.Reader) *bufio.Reader {
|
|
return prependString(string(rn), r)
|
|
}
|
|
|
|
func findFirstTrue(rn rune, functions []RuneFunc) bool {
|
|
for _, f := range functions {
|
|
if f(rn) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func findFirstFalse(rn rune, functions []RuneFunc) bool {
|
|
for _, f := range functions {
|
|
if !f(rn) {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|