Algorithm for like a diff texts
wsjcpp install "https://github.com/wsjcpp/wsjcpp-diff-text:master"
Or copy files to project:
- src.wsjcpp/wsjcpp_core/wsjcpp_core.h
- src.wsjcpp/wsjcpp_core/wsjcpp_core.cpp
- src/wsjcpp_diff_text.h
- src/wsjcpp_diff_text.cpp
#include <wsjcpp_core.h>
#include <wsjcpp_diff_text.h>
...
std::string sFileContent1;
std::string sFileContent2;
WsjcppCore::readTextFile("data/file1.txt", sFileContent1);
WsjcppCore::readTextFile("data/file1.txt", sFileContent2);
std::vector<WsjcppDiffTextRow> vResult;
WsjcppDiffText::compare(sFileContent1, sFileContent2, vResult);
for (int i = 0; i < vResult.size(); i++) {
std::cout <<
vResult[i].getKey() << " => line (" << vResult[i].getNumberOfLine() << "): "
<< vResult[i].getLine() << std::endl;
}
example output:
!del => line (1): 22222
!add => line (6): 71111
!add => line (10): 11111