Main Menu

HOME

.Net
ASP
Assembly
C
C++
Delphi
HTML
Java
JavaScript
MySQL
PC interface
Powershell
Perl
PHP
VBScript
Visual Basic
XML

Make money selling software. Check this out here

Hosted clickbank mall. Check this out here




   Misc

   Amazon

   Links

    


String in another
 

 

 

Description

This example uses the strstr function to see if a string appears in another string

Code

/**************************************
this example uses the strstr function to
check if str2 appears in str1
***************************************/
#include <stdio.h>
#include <string.h>

int main(void)
{
char *str1 = "programmershelp.co.uk c section";
char *str2 = "section";
char *substring;
/*check to see if str2 is in str1*/
substring = strstr(str1,str2);
if (substring != NULL)
printf("%s\n",substring);

return 0;
}

Information

tested using Visual C++ 6

 

 

 

 

 

Download

strstr.txt


 




   Sponsors
 

   Software
500 Java Tips E-book
PHP editor
PERL editor
Beginning Java
Beginning Visual Basic
Learn VB.net
Learn VB 6
VB and databases
ASP image library
C++ builder programming
C++ fundamentals

   Source Code
Title bar flash(VB)
Move a folder with MoveTo(C Sharp)
vertical box scroller(Javascript)
While loop example(Javascript)
Page last accessed(PHP)
start internet explorer(Powershell)
network client information(VBScript)
Date file was created(ASP)

    




Copyright © 2003 by programmershelp.co.uk