1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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 New Member

    Joined:
    Apr 20, 2010
    Messages:
    204
    Likes Received:
    3
    Trophy Points:
    0
    Occupation:
    education
    Location:
    Kerala
    Home Page:
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    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