text

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: BSD-3-Clause Imports: 3 Imported by: 1

Documentation

Overview

Package text provide common a library for working with text.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinChunks

func JoinChunks(chunks []Chunk, sep string) string

JoinChunks all chunk's values using `sep` as separator and return it as string.

Types

type Chunk

type Chunk struct {
	V       []byte
	StartAt int
}

Chunk represent subset of line, contain starting position and slice of bytes in line.

func (Chunk) MarshalJSON added in v0.41.0

func (chunk Chunk) MarshalJSON() ([]byte, error)

MarshalJSON encode the Chunk into JSON value.

func (Chunk) String added in v0.29.1

func (chunk Chunk) String() string

type Chunks

type Chunks []Chunk

Chunks represent a set of chunk.

func (*Chunks) Join

func (chunks *Chunks) Join(sep string) (s string)

Join all chunk's values using `sep` as separator and return it.

type Line

type Line struct {
	V []byte
	N int
}

Line represent line number and slice of bytes as string.

func (Line) MarshalJSON added in v0.41.0

func (line Line) MarshalJSON() ([]byte, error)

MarshalJSON encode the Line into JSON value.

func (Line) String added in v0.29.1

func (line Line) String() string

type Lines

type Lines []Line

Lines represent array of line.

func ParseLines added in v0.29.1

func ParseLines(raw []byte) (lines Lines)

ParseLines convert raw bytes into Lines.

Directories

Path Synopsis
Package diff implement text comparison.
Package diff implement text comparison.

Jump to

Keyboard shortcuts

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