www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/22/04:07:32

From: "Morpheus" <hall AT silo DOT csci DOT unt DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: indexOf function
Date: Mon, 22 Nov 1999 02:17:30 -0600
Organization: University of North Texas
Lines: 21
Message-ID: <81au7i$p1f@hermes.acs.unt.edu>
NNTP-Posting-Host: dfw-premium-69.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

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.
 */
int indexOf(char* lookIn, char* lookFor);

That I could use like this:
char* p = "This and that.";
char* q = "that";
int i = indexOf(p, q);
// so p[i...i+3] = "that"

--
Morpheus
hall AT cs DOT unt DOT edu
http://people.unt.edu/~dahall


- Raw text -


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