|
From: <jos...@ya...> - 2001-03-28 07:05:38
|
Here follows a snippet of the GNU C library
Hope this helps
Chemanuel
**********************************************************************
Search Functions
This section describes library functions which perform various kinds of
searching operations on strings and arrays. These functions are
declared in the header file string.h.
Function: char * strchr (const char *string, int c)
The strchr function finds the first occurrence of the character c
(converted to a char) in the null-terminated string beginning at
string. The return value is a pointer to the located character, or a
null pointer if no match was found.
For example,
strchr ("hello, world", 'l')
=> "llo, world"
strchr ("hello, world", '?')
=> NULL
The terminating null character is considered to be part of the string,
so you can use this function get a pointer to the end of a string by
specifying a null character as the value of the c argument.
Function: char * strstr (const char *haystack, const char *needle)
This is like strchr, except that it searches haystack for a substring
needle rather than just a single character. It returns a pointer into
the string haystack that is the first character of the substring, or a
null pointer if no match was found. If needle is an empty string, the
function returns haystack.
For example,
strstr ("hello, world", "l")
=> "llo, world"
strstr ("hello, world", "wo")
=> "world"
********************************************************************
--- Ian Weston <lak...@ho...> escribió: > Hi again
everyone. i was just wondering if anyone knows how to search
>
> through text for a specified word.
>
> thanks.
>
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/?.refer=text
|