Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Paul_Price

Find a sub string in a string (C#)

This topic is 5172 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am strugling to find the appropriate method for locating an instance of a string within a string for example is there a function to do the following string s1 = "This is some text" string s2 = "some" if(Compare(s1, s2)) { do something; } Thanks guys

Share this post


Link to post
Share on other sites
Advertisement
I think "int position=s1.IndexOf(s2)" should do the trick, can''t check that right now because I am not at home, but I am fairly sure it works.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!