Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Differences between strings

Differences between strings

Scheduled Pinned Locked Moved C#
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tzuiop
    wrote on last edited by
    #1

    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

    C P 2 Replies Last reply
    0
    • T tzuiop

      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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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 )

      1 Reply Last reply
      0
      • T tzuiop

        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

        P Offline
        P Offline
        Phillip M Hoff
        wrote on last edited by
        #3

        There are a number of algorithms that have been developed to determine the similarity between strings (either spelling-wise or pronunciation-wise). A quick Google search brought up this[^], which should give you a good starting point. -Phil

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups