MCPcopy Create free account
hub / github.com/sergi/go-diff / DiffLinesToChars

Method DiffLinesToChars

diffmatchpatch/diff.go:395–398  ·  view source on GitHub ↗

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. It's slightly faster to call DiffLinesToRunes first, followed by DiffMainRunes. At most 1,112,060 unique lines can be encoded across both texts; if t

(text1, text2 string)

Source from the content-addressed store, hash-verified

393// It's slightly faster to call DiffLinesToRunes first, followed by DiffMainRunes.
394// At most 1,112,060 unique lines can be encoded across both texts; if the texts contain more unique lines, this function panics.
395func (dmp *DiffMatchPatch) DiffLinesToChars(text1, text2 string) (string, string, []string) {
396 chars1, chars2, lineArray := dmp.diffLinesToStrings(text1, text2)
397 return chars1, chars2, lineArray
398}
399
400// DiffLinesToRunes splits two texts into a list of runes.
401// At most 1,112,060 unique lines can be encoded across both texts; if the texts contain more unique lines, this function panics.

Calls 1

diffLinesToStringsMethod · 0.95

Tested by 4

TestDiffLinesToCharsFunction · 0.64
TestDiffPartialLineIndexFunction · 0.64