Question

Suppose I have two text files.

The first one, called reference.txt has the following content:

dog goat cat

The second one, called compare.txt has the following content:

cow goat cockroach

I want to compare each character in the 1st and 2nd text files and ignore the whitespace. I've been working it for weeks!

Hope anyone can help me out please. Just give an idea, sure it will be enough for me

Thanks

Was it helpful?

Solution

If you are just thinking about doing comparison ignoring white spaces. Here is the general steps:

  1. Read content of first file into a

  2. Read content of second file into a string

  3. Eliminate all white spaces from both the strings( how? left for figuring out)

  4. Do your comparison.

No code provided since you mentioned that you would like to try on your own.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top