how to divide a string

im not sure im in the suitable forum for my question...
i have a long string (lets say x) and a short string (y) ,now i need to find if y appears in x (dont have to appear in x sequential ).
so first i need to divide x to sub-strings but without missing a matching , how can i do that?
thanks

[312 byte] By [ppl1] at [2007-12-16]
# 1

You can use the String.IndexOf(String) method to determine the index at which a string appears in another string.

DavidM.Kean at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2
but how to divide the string to sub-strings?
also,indexOf is not suitable for this case because is doesnt have to appear sequential
ppl1 at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 3
If you are looking for only parts of string Y in string X, then you'll have to break Y into parts and look for each one in X.

Dividing a string can be done in several ways depending on what you're trying to do. You can use the Split() method on the string object to break the string into an array of sub-strings at every occurrence of a certain character. Also, take a look at the SubString() method of the string class which allows you to specify a starting point and length of the substring.

Mitch Gordon
http://www.enterpriseetc.com

ghostwrtrone at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 4
You are going to have to explain what you are after a little clearer, perhaps give us some information as to what you are trying to achieve.

To split a String, you can use String.Substring(Int32,Int32) or String.Split().

DavidM.Kean at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified