diff – github.com/andreyvit/diff Index | Files

package diff

import "github.com/andreyvit/diff"

diff provides quick and easy string diffing functions based on github.com/sergi/go-diff, mainly for diffing strings in tests

Index

Functions

func CharacterDiff

func CharacterDiff(a, b string) string

CharacterDiff returns an inline diff between the two strings, using (++added++) and (~~deleted~~) markup.

func LineDiff

func LineDiff(a, b string) string

LineDiff returns a normal linewise diff between the two given strings.

func LineDiffAsLines

func LineDiffAsLines(a, b string) []string

LineDiffAsLines returns the lines of a linewise diff between the two given strings.

func TrimLines

func TrimLines(input []string) []string

TrimLines applies TrimSpace to each string in the given array.

func TrimLinesInString

func TrimLinesInString(input string) string

TrimLinesInString applies TrimSpace to each line in the given string, and returns the new trimmed string. Empty lines are not removed.

Source Files

diff.go doc.go trim.go

Version
v0.0.0-20170406064948-c7f18ee00883 (latest)
Published
Apr 6, 2017
Platform
js/wasm
Imports
3 packages
Last checked
1 month ago

Tools for package owners.