need help comparing strings

This is a discussion on need help comparing strings within the C Programming forums, part of the General Programming Boards category; I need methods or some say to check a) if two strings of equal length have all but one character ...

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    11

    need help comparing strings

    I need methods or some say to check


    a) if two strings of equal length have all but one character in common, that is in the same position in both words.
    example, pale and pane, or cat and can.


    b) if a string is the same as another string except with one additonal letter(anywhere within the string)
    example, paste and past, or cart and carat
    so all the letters in common must be in the same order in both words, but the extra letter in the longer string can be anywhere


    not sure if strcmp or something could work with this.


    this is being done in a unix environment with the gcc compiler, if that matters

  2. #2
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,058
    Dude! you need to roll your own because the likes of strcmp() ain't gonna cut it.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    So get on it, and tell us when you're stuck. We're not here to do everything for you.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 04-29-2009, 11:13 AM
  2. Problem with comparing strings!
    By adrian2009 in forum C Programming
    Replies: 2
    Last Post: 02-28-2009, 10:44 PM
  3. comparing strings using argv
    By eth0 in forum C Programming
    Replies: 2
    Last Post: 09-20-2005, 10:20 AM
  4. comparing strings
    By infinitum in forum C++ Programming
    Replies: 1
    Last Post: 05-03-2003, 01:10 PM
  5. Comparing Strings
    By Perica in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2003, 11:41 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21