untilread

package module
v0.0.0-...-412b808 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2017 License: MIT Imports: 4 Imported by: 0

README

go-untilread

untilread provide read function of until separator

Usage

package main

import (
	"fmt"
	"strings"

	"github.com/844196/go-untilread"
)

func main() {
	src := "こんにちは、ジャパリパーク。さようなら、世界。"
	sep := "。"
	ir := strings.NewReader(src)

	untilread.Do(ir, sep, func(s string) error {
		fmt.Println(s)
		return nil
	})
	// Output:
	// こんにちは、ジャパリパーク。
	// さようなら、世界。
}

Installation

$ go get github.com/844196/go-untilread

Documentation

Overview

Package untilread provide read function of until separator

Example
src := "こんにちは、ジャパリパーク。さようなら、世界。"
sep := "。"
ir := strings.NewReader(src)

untilread.Do(ir, sep, func(s string) error {
	fmt.Println(s)
	return nil
})
Output:

こんにちは、ジャパリパーク。
さようなら、世界。

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(r io.Reader, sep string, f func(string) error) error

Do read io.Reader until separator chars, read string pass to anonymous function. Anonymous function of argument should return err or nil. if read failed or anonymous function return err, "Do" return err.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL