I've been attempting to create a version control system using strings (Files in Base64) in Javascript. I figure instead of storing every version of a file as a completely new file this will cut down on space. Instead I would like to create a chain of differences based on an original file.
For example:
new_version("Hello world! My name is Bob.", "Hello world! My Papa is Sam.")
should return something like ?16?P?1?pa?4?Sam?1?
Where the integer represents how many spaces to skip before making a change. The issue I'm facing is words with different lengths. Replacing Sam with Bill would completely alter the remaining string. I'm wondering if there is a better way than comparing every character as I've done for my prototype.