Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Stripos (http://www.go4expert.com/forums/stripos-t22363/)

sahems87 9Jun2010 18:35

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.

unni krishnan.r 9Jun2010 18:45

Re: Stripos

xpi0t0s 10Jun2010 12:40

Re: Stripos
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?

All times are GMT +5.5. The time now is 16:40.