L
L
Lici2015-03-22 11:09:41
Swift
Lici, 2015-03-22 11:09:41

SWIFT Algorithm for finding differences in texts?

I want to write a software where you insert 2 texts and it looks for where they are cast and highlights them with color. Type of search for the adjustments made.
So, is there a ready-made algorithm for finding differences? So far, it occurred to me to compare character-by-character from the moment of finding 1 matching character to the moment when the next-next-...-next character suddenly does not match in the sequence.
But the algorithm doesn't seem to be efficient or optimal, and I don't want to make a bicycle - is there an algorithm-library-function for this in Swift?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
ManWithBear, 2015-03-22
@Lici

Library from Google Google diff-match-patch.
You are interested in diff.

A
asd111, 2015-03-22
@asd111

habrahabr.ru/post/142676

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question