It depend what you mean with difference.
Show exemplary what you mean.
...
This is a nice day, the sky is blue and wind blowing sun is rising.
This is a nice day with many kills, the sky is red and wind blowing sun is somwhere, because all dark here.
... looks like this feature
https://github.com/rickard67/TextDiff (https://github.com/rickard67/TextDiff)
SynEdit doesn't have that....
I don't know how it's done in TextDiff, but in LGenerics it's very easy:
$ cat ttt
#!/usr/bin/ksh
for ((i=1;i<3;i++))
do
echo "Unmatched words from string ${i}"
comm <(echo "This is a nice day, the sky is blue and wind blowing sun is rising." |tr ' ' '\n' | sed 's/\.//' |sed 's/,//' |sort) <(echo "This is a nice day with many kills, the sky is red and wind blowing sun is somewhere, because all dark here." | tr ' ' '\n' | sed 's/\.//' | sed 's/,//' |sort) | cut -f${i} |sed '/^$/d'
echo
done
$ cat t.pp
program t;
uses Unix;
Var S : Longint;
begin
S:=fpSystem('./ttt');
end.
$ ./t
Unmatched words from string 1
blue
rising
Unmatched words from string 2
all
because
blue
dark
here
kills
many
red
rising
somewhere
with
$
;D
...
Thank you, I'd like to try, but where can I found this LGenerics/lgSeqUtils ?
...
...
Thank you, I'd like to try, but where can I found this LGenerics/lgSeqUtils ?
...
It lives here (https://github.com/avk959/LGenerics).
@totya
Not sure that it will match your needs, but there is also this project: https://github.com/DomingoGP/lazIdeDiffCompareFiles
@totya, the vector of boolean values SourceChanges corresponds to the elements of the source sequence and contains True in those positions, the elements of which are not included in the target sequence. That is, if SourceChanges[2] is True, it means that the source sequence element with index 2 is not in the target sequence.
... looks like this feature
https://github.com/rickard67/TextDiff (https://github.com/rickard67/TextDiff)
Delhpi uses 2 byte coded chars (UTF-16).Wrong! UTF16 has between 2 and 4 bytes.
But {$mode delphi} do not works perfectly, so if I modify, for example:Because you use the wrong mode: you should have used {$mode delphiunicode}
char->widechar
string->WideString
Delhpi uses 2 byte coded chars (UTF-16).Wrong! UTF16 has between 2 and 4 bytes.
But {$mode delphi} do not works perfectly, so if I modify, for example:Because you use the wrong mode: you should have used {$mode delphiunicode}
char->widechar
string->WideString
Also note that LCS - what you need for a diff - is a bytewise comparision, not a character based comparison and the latest TDiff is known for that reason to work with UTF8 too..
UTF-16 and UTF-32 is fixed size code,
UTF-16 and UTF-32 is fixed size code,
No UTF-16 is not fixed size.
UTF-16 has a CodeUnit size of 2 byte. (UTF-8 has 1 byte, and UTF-32 has 4).
In UTF-16: A Unicode codepoint can be represented by 1 or 2 CodeUnits (2 or 4 bytes).
A "character" can be either a single codepoint, or a combination of several codepoints. (That applies to Unicode itself, so that is the case for UTF-8, UTF-16 and UTF-32 and any other transfer encoding)
Then you know wrong.UTF-16 and UTF-32 is fixed size code,
No UTF-16 is not fixed size.
UTF-16 has a CodeUnit size of 2 byte. (UTF-8 has 1 byte, and UTF-32 has 4).
In UTF-16: A Unicode codepoint can be represented by 1 or 2 CodeUnits (2 or 4 bytes).
A "character" can be either a single codepoint, or a combination of several codepoints. (That applies to Unicode itself, so that is the case for UTF-8, UTF-16 and UTF-32 and any other transfer encoding)
I know otherwise,
for example I hate UTF8 because this NOT only 1 byte length, this is variable length (1-4 byte) so very complicated to handle it, but I see many function available (ex.: LazUTF8: UT8Pos, UT8copy etc).
And in UTF-16 (unlike UCS-2) you got 2 or 4 bytes.
UTF-16 has surrogates. And they are 4 bytes.
For example the following emoticons use 4 bytes in UTF-16 https://www.compart.com/en/unicode/block/U+1F600
Click then, see the UTF-16 encoding.
Thanks, because you know wrong already, and u see here, UTF-8 is not only 1 byte... in this example it's 4 byte length.
UTF-16 has a CodeUnit size of 2 byte. (UTF-8 has 1 byte, and UTF-32 has 4).
You must have misread me.
The result: last character missing from the compare.
QuoteThe result: last character missing from the compare.I have found the problem with the last char in TDiff in the
But I will look your Diff2.pas version too.
You are welcome1.QuoteBut I will look your Diff2.pas version too.
You don't need to do, basically is the same as https://github.com/rickard67/TextDiff with minor changes.
Because you use the wrong mode: you should have used {$mode delphiunicode}