Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/sergi/go-diff
/ functions
Functions
118 in github.com/sergi/go-diff
⨍
Functions
118
◇
Types & classes
10
↓ 42 callers
Function
New
New creates a new DiffMatchPatch object with default parameters.
diffmatchpatch/diffmatchpatch.go:35
↓ 17 callers
Method
DiffMain
DiffMain finds the differences between two texts. If an invalid UTF-8 sequence is encountered, it will be replaced by the Unicode replacement characte
diffmatchpatch/diff.go:84
↓ 12 callers
Method
PatchMake
PatchMake computes a list of patches.
diffmatchpatch/patch.go:115
↓ 12 callers
Function
splice
splice removes amount elements from slice at index index, replacing them with elements.
diffmatchpatch/diff.go:46
↓ 11 callers
Method
String
String emulates GNU diff's format. Header: @@ -382,8 +481,9 @@ Indices are printed as 1-based, not 0-based.
diffmatchpatch/patch.go:33
↓ 9 callers
Method
DiffText1
DiffText1 computes and returns the source text (all equalities and deletions).
diffmatchpatch/diff.go:1180
↓ 9 callers
Function
getBits
Helper for getting a sequence of bits from an integer.
diffmatchpatch/stringutil.go:116
↓ 8 callers
Method
MatchBitap
MatchBitap locates the best instance of 'pattern' in 'text' near 'loc' using the Bitap algorithm. Returns -1 if no match was found.
diffmatchpatch/match.go:37
↓ 7 callers
Method
DiffCharsToLines
DiffCharsToLines rehydrates the text in a diff from a string of line hashes to real lines of text.
diffmatchpatch/diff.go:404
↓ 7 callers
Method
diffMainRunes
(text1, text2 []rune, checklines bool, deadline time.Time)
diffmatchpatch/diff.go:98
↓ 6 callers
Method
PatchToText
PatchToText takes a list of patches and returns a textual representation.
diffmatchpatch/patch.go:469
↓ 6 callers
Function
commonPrefixLength
commonPrefixLength returns the length of the common prefix of two rune slices.
diffmatchpatch/diff.go:433
↓ 6 callers
Function
commonSuffixLength
commonSuffixLength returns the length of the common suffix of two rune slices.
diffmatchpatch/diff.go:445
↓ 5 callers
Method
MatchMain
MatchMain locates the best instance of 'pattern' in 'text' near 'loc'. Returns -1 if no match found.
diffmatchpatch/match.go:17
↓ 5 callers
Method
matchBitapScore
matchBitapScore computes and returns the score for a match with e errors and x location.
diffmatchpatch/match.go:128
↓ 5 callers
Function
max
(x, y int)
diffmatchpatch/mathutil.go:18
↓ 4 callers
Method
DiffCleanupMerge
DiffCleanupMerge reorders and merges like edit sections. Merge equalities. Any edit section can move as long as it doesn't cross an equality.
diffmatchpatch/diff.go:958
↓ 4 callers
Method
DiffCleanupSemantic
DiffCleanupSemantic reduces the number of edits by eliminating semantically trivial equalities.
diffmatchpatch/diff.go:606
↓ 4 callers
Method
DiffFromDelta
DiffFromDelta given the original text1, and an encoded string which describes the operations required to transform text1 into text2, comAdde the full
diffmatchpatch/diff.go:1261
↓ 4 callers
Method
DiffLinesToChars
DiffLinesToChars splits two texts into a list of strings, and educes the texts to a string of hashes where each Unicode character represents one line.
diffmatchpatch/diff.go:392
↓ 4 callers
Method
DiffText2
DiffText2 computes and returns the destination text (all equalities and insertions).
diffmatchpatch/diff.go:1193
↓ 4 callers
Method
PatchApply
PatchApply merges a set of patches onto the text. Returns a patched text, as well as an array of true/false values indicating which patches were appl
diffmatchpatch/patch.go:232
↓ 4 callers
Method
PatchFromText
PatchFromText parses a textual representation of patches and returns a List of Patch objects.
diffmatchpatch/patch.go:478
↓ 4 callers
Function
diffCleanupSemanticScore
diffCleanupSemanticScore computes a score representing whether the internal boundary falls on logical boundaries. Scores range from 6 (best) to 0 (wor
diffmatchpatch/diff.go:732
↓ 4 callers
Function
speedtestTexts
()
diffmatchpatch/benchutil_test.go:17
↓ 3 callers
Method
DiffCleanupEfficiency
DiffCleanupEfficiency reduces the number of edits by eliminating operationally trivial equalities.
diffmatchpatch/diff.go:847
↓ 3 callers
Method
DiffCleanupSemanticLossless
DiffCleanupSemanticLossless looks for single edits surrounded on both sides by equalities which can be shifted sideways to align the edit to a word bo
diffmatchpatch/diff.go:774
↓ 3 callers
Method
DiffCommonOverlap
DiffCommonOverlap determines if the suffix of one string is the prefix of another.
diffmatchpatch/diff.go:460
↓ 3 callers
Method
DiffCommonSuffix
DiffCommonSuffix determines the common suffix length of two strings.
diffmatchpatch/diff.go:427
↓ 3 callers
Method
DiffHalfMatch
DiffHalfMatch checks whether the two texts share a substring which is at least half the length of the longer text. This speedup can produce non-minima
diffmatchpatch/diff.go:500
↓ 3 callers
Method
DiffLinesToRunes
DiffLinesToRunes splits two texts into a list of runes.
diffmatchpatch/diff.go:398
↓ 3 callers
Method
DiffMainRunes
DiffMainRunes finds the differences between two rune sequences. If an invalid UTF-8 sequence is encountered, it will be replaced by the Unicode replac
diffmatchpatch/diff.go:90
↓ 3 callers
Method
DiffToDelta
DiffToDelta crushes the diff into an encoded string which describes the operations required to transform text1 into text2. E.g. =3\t-2\t+ing -> Keep
diffmatchpatch/diff.go:1230
↓ 3 callers
Method
DiffXIndex
DiffXIndex returns the equivalent location in s2.
diffmatchpatch/diff.go:1085
↓ 3 callers
Method
PatchAddContext
PatchAddContext increases the context until it is unique, but doesn't let the pattern expand beyond MatchMaxBits.
diffmatchpatch/patch.go:74
↓ 3 callers
Method
diffBisectSplit
(runes1, runes2 []rune, x, y int, deadline time.Time)
diffmatchpatch/diff.go:376
↓ 3 callers
Function
indexOf
indexOf returns the first index of pattern in str, starting at str[i].
diffmatchpatch/stringutil.go:32
↓ 3 callers
Function
indexesToString
(indexes []index)
diffmatchpatch/index.go:22
↓ 3 callers
Function
intToRune
Converts an integer in the range 0~1112060 into a rune. Based on the ranges table in https://en.wikipedia.org/wiki/UTF-8
diffmatchpatch/stringutil.go:122
↓ 3 callers
Function
min
(x, y int)
diffmatchpatch/mathutil.go:11
↓ 3 callers
Function
runesIndex
runesIndex is the equivalent of strings.Index for rune slices.
diffmatchpatch/stringutil.go:86
↓ 3 callers
Function
runesIndexOf
runesIndexOf returns the index of pattern in target, starting at target[i].
diffmatchpatch/stringutil.go:59
↓ 2 callers
Method
DiffBisect
DiffBisect finds the 'middle snake' of a diff, split the problem in two and return the recursively constructed diff. If an invalid UTF-8 sequence is e
diffmatchpatch/diff.go:254
↓ 2 callers
Method
DiffCommonPrefix
DiffCommonPrefix determines the common prefix length of two strings.
diffmatchpatch/diff.go:421
↓ 2 callers
Method
DiffLevenshtein
DiffLevenshtein computes the Levenshtein distance that is the number of inserted, deleted or substituted characters.
diffmatchpatch/diff.go:1205
↓ 2 callers
Method
MatchAlphabet
MatchAlphabet initialises the alphabet for the Bitap algorithm.
diffmatchpatch/match.go:143
↓ 2 callers
Method
PatchAddPadding
PatchAddPadding adds some padding on text start and end so that edges can match something. Intended to be called only from within patchApply.
diffmatchpatch/patch.go:323
↓ 2 callers
Method
PatchSplitMax
PatchSplitMax looks through the patches and breaks up any which are longer than the maximum limit of the match algorithm. Intended to be called only f
diffmatchpatch/patch.go:375
↓ 2 callers
Method
diffBisect
diffBisect finds the 'middle snake' of a diff, splits the problem in two and returns the recursively constructed diff. See Myers's 1986 paper: An O(ND
diffmatchpatch/diff.go:261
↓ 2 callers
Method
diffHalfMatch
(text1, text2 []rune)
diffmatchpatch/diff.go:514
↓ 2 callers
Method
diffHalfMatchI
diffHalfMatchI checks if a substring of shorttext exist within longtext such that the substring is at least half the length of longtext? Returns a sli
diffmatchpatch/diff.go:565
↓ 2 callers
Method
diffLinesToStrings
diffLinesToStrings splits two texts into a list of strings. Each string represents one line.
diffmatchpatch/diff.go:1322
↓ 2 callers
Method
diffLinesToStringsMunge
diffLinesToStringsMunge splits a text into an array of strings, and reduces the texts to a []index.
diffmatchpatch/diff.go:1334
↓ 2 callers
Function
diffRebuildTexts
(diffs []Diff)
diffmatchpatch/diff_test.go:48
↓ 2 callers
Function
intArrayToString
(ns []index)
diffmatchpatch/stringutil.go:96
↓ 2 callers
Function
lastIndexOf
lastIndexOf returns the last index of pattern in str, starting at str[i].
diffmatchpatch/stringutil.go:47
↓ 2 callers
Function
runeToInt
Converts a rune generated by intToRune back to an integer
diffmatchpatch/stringutil.go:161
↓ 2 callers
Function
runesEqual
(r1, r2 []rune)
diffmatchpatch/stringutil.go:73
↓ 1 callers
Method
DiffPrettyHtml
DiffPrettyHtml converts a []Diff into a pretty HTML report. It is intended as an example from which to write one's own display functions.
diffmatchpatch/diff.go:1119
↓ 1 callers
Method
DiffPrettyText
DiffPrettyText converts a []Diff into a colored text report.
diffmatchpatch/diff.go:1142
↓ 1 callers
Method
PatchDeepCopy
PatchDeepCopy returns an array that is identical to a given an array of patches.
diffmatchpatch/patch.go:212
↓ 1 callers
Method
diffCompute
diffCompute finds the differences between two rune slices. Assumes that the texts do not have any common prefix or suffix.
diffmatchpatch/diff.go:133
↓ 1 callers
Method
diffLineMode
diffLineMode does a quick line-level diff on both []runes, then rediff the parts for greater accuracy. This speedup can produce non-minimal diffs.
diffmatchpatch/diff.go:194
↓ 1 callers
Method
patchMake2
patchMake2 computes a list of patches to turn text1 into text2. text2 is not provided, diffs are the delta between text1 and text2.
diffmatchpatch/patch.go:141
↓ 1 callers
Function
stringToIndex
next invalid code point
diffmatchpatch/index.go:9
Function
BenchmarkCommonLength
(b *testing.B)
diffmatchpatch/diff_test.go:149
Function
BenchmarkDiffCleanupSemantic
(b *testing.B)
diffmatchpatch/diff_test.go:872
Function
BenchmarkDiffCommonPrefix
(b *testing.B)
diffmatchpatch/diff_test.go:85
Function
BenchmarkDiffCommonSuffix
exported sink var to avoid compiler optimizations in benchmarks
diffmatchpatch/diff_test.go:137
Function
BenchmarkDiffHalfMatch
(b *testing.B)
diffmatchpatch/diff_test.go:270
Function
BenchmarkDiffMain
(bench *testing.B)
diffmatchpatch/diff_test.go:1514
Function
BenchmarkDiffMainLarge
(b *testing.B)
diffmatchpatch/diff_test.go:1534
Function
BenchmarkDiffMainRunesLargeDiffLines
(b *testing.B)
diffmatchpatch/diff_test.go:1561
Function
BenchmarkDiffMainRunesLargeLines
(b *testing.B)
diffmatchpatch/diff_test.go:1546
Method
String
()
diffmatchpatch/operation_string.go:11
Function
TestCommonPrefixLength
(t *testing.T)
diffmatchpatch/diff_test.go:95
Function
TestCommonSuffixLength
(t *testing.T)
diffmatchpatch/diff_test.go:181
Function
TestDiffBisect
(t *testing.T)
diffmatchpatch/diff_test.go:1218
Function
TestDiffBisectSplit
(t *testing.T)
diffmatchpatch/diff_test.go:282
Function
TestDiffCharsToLines
(t *testing.T)
diffmatchpatch/diff_test.go:350
Function
TestDiffCleanupEfficiency
(t *testing.T)
diffmatchpatch/diff_test.go:886
Function
TestDiffCleanupMerge
(t *testing.T)
diffmatchpatch/diff_test.go:395
Function
TestDiffCleanupSemantic
(t *testing.T)
diffmatchpatch/diff_test.go:616
Function
TestDiffCleanupSemanticLossless
(t *testing.T)
diffmatchpatch/diff_test.go:478
Function
TestDiffCommonOverlap
(t *testing.T)
diffmatchpatch/diff_test.go:200
Function
TestDiffCommonPrefix
(t *testing.T)
diffmatchpatch/diff_test.go:63
Function
TestDiffCommonSuffix
(t *testing.T)
diffmatchpatch/diff_test.go:113
Function
TestDiffDelta
(t *testing.T)
diffmatchpatch/diff_test.go:1087
Function
TestDiffHalfMatch
(t *testing.T)
diffmatchpatch/diff_test.go:225
Function
TestDiffLevenshtein
(t *testing.T)
diffmatchpatch/diff_test.go:1197
Function
TestDiffLinesToChars
(t *testing.T)
diffmatchpatch/diff_test.go:304
Function
TestDiffMain
(t *testing.T)
diffmatchpatch/diff_test.go:1274
Function
TestDiffMainWithCheckLines
(t *testing.T)
diffmatchpatch/diff_test.go:1434
Function
TestDiffMainWithTimeout
(t *testing.T)
diffmatchpatch/diff_test.go:1409
Function
TestDiffPartialLineIndex
(t *testing.T)
diffmatchpatch/diff_test.go:1482
Function
TestDiffPrettyHtml
(t *testing.T)
diffmatchpatch/diff_test.go:992
Function
TestDiffPrettyText
(t *testing.T)
diffmatchpatch/diff_test.go:1017
Function
TestDiffText
(t *testing.T)
diffmatchpatch/diff_test.go:1053
Function
TestDiffXIndex
(t *testing.T)
diffmatchpatch/diff_test.go:1176
Function
TestIndexConversion
(t *testing.T)
diffmatchpatch/index_test.go:8
next →
1–100 of 118, ranked by callers