vikasgkutty
asked on
check if a string is substring of another(Easy q)
I have a string named in a variable lets say X
I have another string variable called Y
All I need to do is check if X is a subset of Y
for example if X="S1P1"
and Y= "S1P1s"
then it should give me true when i check this
Easy question,rt..
I have another string variable called Y
All I need to do is check if X is a subset of Y
for example if X="S1P1"
and Y= "S1P1s"
then it should give me true when i check this
Easy question,rt..
use strstr() provided in string.h
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
For your e.g.
char *ptr=strstr(Y,X);
char *ptr=strstr(Y,X);
vikasgkutty:
This is homework, isn't it?
This is homework, isn't it?
Absolutely, this looks nothing but a homework. These type of assignments we used to get in our semesters and of course we had to implement them without using string libraries.
Avik.
Avik.
ASKER
how can this be homework, crazycomputers?
this is a very small check i wanted to do, in a project, tht I have been doing all sem,as Avik said
this is a very small check i wanted to do, in a project, tht I have been doing all sem,as Avik said