Results 1 to 1 of 1

Thread: File and/or String Comparisons

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2015
    Location
    Colorado USA
    Posts
    261

    File and/or String Comparisons

    CompareFiles

    This program highlights four different modules that allow you to compare files or strings for changes. In each case I shell to another program to do the file or string comparison. Rather than re-create the comparison routines, I take advantage of a) the comparisons and presentation are already done and we don’t care whether the user has the 32 or 64-bit versions of the programs installed.

    You don’t need all 4 modules. I included them in this sample program so that you could test each one and see which one you prefer. My personal preference is Notepad++, a free text editor available from here that comes in 32/64 bits for Windows.. Another option is ExamDiff, a freeware program available here. It has a Pro version that is not free but this utility uses the free version which is 32-bit.

    Another option is WinMerge, a free utility in 32and 64-bit available here. Finally there is Microsoft Word, which is part of the paid Office suite or as a standalone product here. It is not free but is available in 32 and 64-bits. I think it has the ugliest file comparison features but it has the advantage that it can compare files that are not just text files.

    I am guessing that OpenOffice and LibreOffice have file comparison routines similar to MS Word but I haven’t checked them out. Word’s routine is sufficiently ugly that I stopped there.

    Compare Text on the Clipboard with a File

    Use of Notepad++ has an added feature you may find useful. Normally you enter the 2 filenames and the procedure compares the files. However, if you leave one of the filenames blank the comparison will be made between the one file and whatever text is on the clipboard.

    Compare Strings

    Each of the modules contains a comparison routine for files and a comparison routine for strings. The utility only uses the CompareFiles routines but the CompareStrings routines are available for your use as well.
    There are some differences in how the CompareStrings routines work.
    When you use Notepad++ to compare 2 strings, no temporary files are made.
    When using ExamDiff to compare strings, 2 temporary file are made in the TEMP folder.
    When you use WinMerge to compare two strings, no temporary files are made.
    When you use MS Word to compare 2 strings, one temporary file is created/used in the TEMP folder.
    Sample
    In the zip file are File1.txt and File2.txt that are deliberately different in a few areas. Below are the results of doing a comparison in each of the 4 external programs.

    Notepad++:
    Name:  NotepadPlusPlus.jpg
Views: 1073
Size:  24.1 KB

    WinMerge:
    Name:  WinMerge.jpg
Views: 17831
Size:  21.6 KB

    ExamDiff:
    Name:  ExamDiff.jpg
Views: 8650
Size:  19.2 KB

    MS Word:
    Name:  MSWord.jpg
Views: 2307
Size:  23.7 KB

    Update- I forgot to point out that in Notepad++ you need the "Compare" plug-in in order to do file or string comparisons. I have been using it for so many years that it slipped my mind that it doesn't come with the standard download of Notepad++. It is available here.
    Attached Files Attached Files
    Last edited by MountainMan; Aug 19th, 2020 at 01:22 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width