Differences between strings
-
Hello, I want to write a small vocabulary trainer (EN <=> Spanish). Now I need to know, if two strings are similar. When the trainer ask you, what the meaning of "veinte" is, and the user writes "tewnty" instead of "twenty" the application should only remark that there is a small mistake in the input. When he writes a total different word (e.g. wine) then the trainer should say, that there is a mistake in the input. Know anyone of you a good class, which compares two strings on similarities? The class should detect if there is a letter missing or a letter too much (or 2 letters are flipped). Till now I just found classes, which compares complete texts and which say that a line in text A is different to a line in text B. Bye
-
Hello, I want to write a small vocabulary trainer (EN <=> Spanish). Now I need to know, if two strings are similar. When the trainer ask you, what the meaning of "veinte" is, and the user writes "tewnty" instead of "twenty" the application should only remark that there is a small mistake in the input. When he writes a total different word (e.g. wine) then the trainer should say, that there is a mistake in the input. Know anyone of you a good class, which compares two strings on similarities? The class should detect if there is a letter missing or a letter too much (or 2 letters are flipped). Till now I just found classes, which compares complete texts and which say that a line in text A is different to a line in text B. Bye
You'd have to write something to do this. A starting point may be to sort both strings alphabetically, and then compare them, to work out if you only have an error of letter order. Then you can walk them character by character, to work out a list of letters that were added, and that were missing, if the wrong letters were also used.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Hello, I want to write a small vocabulary trainer (EN <=> Spanish). Now I need to know, if two strings are similar. When the trainer ask you, what the meaning of "veinte" is, and the user writes "tewnty" instead of "twenty" the application should only remark that there is a small mistake in the input. When he writes a total different word (e.g. wine) then the trainer should say, that there is a mistake in the input. Know anyone of you a good class, which compares two strings on similarities? The class should detect if there is a letter missing or a letter too much (or 2 letters are flipped). Till now I just found classes, which compares complete texts and which say that a line in text A is different to a line in text B. Bye