www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/22/16:35:59

From: "Morpheus" <hall AT silo DOT csci DOT unt DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: indexOf function
Date: Mon, 22 Nov 1999 14:52:56 -0600
Organization: University of North Texas
Lines: 25
Message-ID: <81cafs$6m8@hermes.acs.unt.edu>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 991122131030 DOT 4922B-100000 AT is>
NNTP-Posting-Host: dfw-premium-12.dialup.unt.edu
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Could I use some pointer arithmetic to find the index once I use strstr? If
so, I'm not exactly sure how I'd do it. Could you demonstrate?

--
Morpheus
hall AT cs DOT unt DOT edu
http://people.unt.edu/~dahall
Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote in message
news:Pine DOT SUN DOT 3 DOT 91 DOT 991122131030 DOT 4922B-100000 AT is...
>
> On Mon, 22 Nov 1999, Morpheus wrote:
>
> > Does the standard library have an indexOf function for char pointers
similar
> > to a static version of java's java.lang.String.indexOf()?
> >
> > As in:
> > /* Returns the index of lookFor in lookIn if lookFor is found in lookIn;
> >  * else returns -1.
>
> The Standard C library includes a function called `strstr' which does the
> same, except that it returns a pointer to the substring if it finds one,
> NULL if not.


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019