textwrapper

package
v0.0.0-...-c54e73f Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: MIT, MIT Imports: 1 Imported by: 0

README

go-textwrapper

GoDoc Build Status

A writer that wraps long text lines to a specified length

Usage

import (
	"os"

	"gitee.com/wpkg/message/textwrapper"
)

func main() {
	w := textwrapper.New(os.Stdout, "/", 5)

	w.Write([]byte("helloworldhelloworldhelloworld"))
	// Output: hello/world/hello/world/hello/world
}

License

MIT

Documentation

Overview

A writer that wraps long text lines to a specified length.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(w io.Writer, sep string, l int) io.Writer

Returns a writer that splits its input into multiple parts that have the same length and adds a separator between these parts.

func NewRFC822

func NewRFC822(w io.Writer) io.Writer

Creates a RFC822 text wrapper. It adds a CRLF (ie. \r\n) each 76 characters.

Types

This section is empty.

Jump to

Keyboard shortcuts

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