case insensitive strstr?

This is a discussion on case insensitive strstr? within the C Programming forums, part of the General Programming Boards category; Is there an case insensitive strstr? because there are strcmp <-> stricmp, but no stristr... I know I could first ...

  1. #1
    Mox
    Mox is offline
    Registered User
    Join Date
    Aug 2001
    Posts
    41

    case insensitive strstr?

    Is there an case insensitive strstr?
    because there are strcmp <-> stricmp, but no stristr...
    I know I could first make copies of the two strings, both to lower or upper case, but that's not really memory friendly...

    Any suggestions?
    Thanks,

    Joren

  2. #2
    Sayeh
    Guest
    of course, just write your own.

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    2
    theres not really a 'best' way to do this.. that is probably why stristr(..) is not ansi.. you could convert the strings to all one case.. or you could compare the ascii values on the strings.. the first option will be more expensive to memory and the second will use the CPU more.. either way would work.. unless you are searching a hugeass string i would use the first one..

    im sure there are X number of other ways to do this too...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How can I make this code more elegant?
    By ejohns85 in forum C++ Programming
    Replies: 3
    Last Post: 04-02-2009, 09:55 AM
  2. Format Precision & Scale
    By mattnewtoc in forum C Programming
    Replies: 1
    Last Post: 09-16-2008, 11:34 AM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 02:01 AM
  4. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  5. Keypress reading
    By geek@02 in forum Windows Programming
    Replies: 1
    Last Post: 06-16-2004, 01:16 PM

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