Locating Strings
Hi,
Does anyone know how to locate strings? I''ve tried all the different variants in the C++ language, but none work (not for me anyway).
So far I have tried experimenting with strstr(mainstr,substr) but I do not achieve the results I want. To give you an idea of what I''m trying to do, I shall do it BASIC.
a$="Help me please!!!!"
b$="me"
for x=1 to len(a$)
c$=mid$(a$,x,2):rem the 2 means how many chars to read from x
if c$=b$ print"Found you!!":END
next
I hope that gives you an idea what I''m trying to do. It''s amazing when you try something like this you realise the sort of functions that didn''t make into C/C++.
Any help will be greatly appreciated.
Thankyou ALL.
Indy
Indy
You need a book, this one : http://www.amazon.com/exec/obidos/ASIN/0201379260/ref=lm_lb_6/104-1773197-6899106.
here is how you do it :
There is a nice function find which return the position of the begining of the substring or std::string::npos if it does not find the string :
here is how you do it :
There is a nice function find which return the position of the begining of the substring or std::string::npos if it does not find the string :
|
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement