Stripos

Discussion in 'C' started by sahems87, Jun 9, 2010.

  1. sahems87

    sahems87 New Member

    Joined:
    Jun 9, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    stripos — Find position of first occurrence of a case-insensitive string
    int stripos ( char* haystack, char* needle, int offset )
    Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1.
    The function should not make use of any C library function calls.
     
  2. unni krishnan.r

    unni krishnan.r Member

    Joined:
    Apr 20, 2010
    Messages:
    209
    Likes Received:
    4
    Trophy Points:
    18
    Occupation:
    education
    Location:
    Kerala
    Home Page:
    http://blogofunni.blogspot.com
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    How far have you got and where are you stuck? Do you understand the requirements?
    How do you think it might work (i.e. outline the basic algorithm).
    Do you know how to find a single char in a string? Since a string comprises multiple chars that might be a useful first step. Can you find an 's' in "haystack"? What about a 'u'? If you can find an 's', could you find "sta"? Could you find "sub"? For each question, why or why not?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice