Re: [NEWBIE] Find a chars name in a string

From: George (greerga@CIRCLEMUD.ORG)
Date: 01/05/98


On Sat, 3 Jan 1998, - Pure Krome - wrote:

>if i have some string (eg .. "hello everyone one. My name is
>DumbNewbie!"), what C function would return TRUE or whatever if i'm
>trying to test if string "DumbNewbie" - or for that matter, _any_ string
>- in some other string.

(May vary with OS)

NAME
       strstr - locate a substring

SYNOPSIS
       #include <string.h>

       char *strstr(const char *haystack, const char *needle);

DESCRIPTION
       The  strstr()  function  finds the first occurrence of the
       substring needle in the string haystack.  The  terminating
       `\0' characters are not compared.

RETURN VALUE
       The  strstr()  function returns a pointer to the beginning
       of the substring, or NULL if the substring is not found.

SEE ALSO
       index(3),  memchr(3),  rindex(3),  strchr(3),  strpbrk(3),
       strsep(3), strspn(3), strtok(3)

char *where_is_it = strstr(string_given, "DumbNewbie");

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST