Newbie: Is there simple way to find a string in a long string?

  • Thread starter Thread starter Galaxia
  • Start date Start date
G

Galaxia

Hi,

Is there any simple method to search a short string in a long string?
I want to test whether the short string is contained in the long string, just like something as CString.Find(...) in MFC. Is there similar thing in .Net Framework? I failed to find it.

--
"Forward Galaxia"
 
Galaxia said:
Hi,

Is there any simple method to search a short string in a long string?
I want to test whether the short string is contained in the long string,
just like something as CString.Find(...) in MFC. Is there similar thing
in .Net Framework? I failed to find it.

String.IndexOf();

if (stringVar.IndexOf("StringToSearchFor") > -1)
...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top