Split function for more than one parameter...

Kapildalke
Posted by Kapildalke under C# category on | Points: 40 | Views : 1115
As you know that we have split function for split based on a particular character
Like
string str="This is very good string and every | bode can use it"

//string strPhrase = child.Phrase.Split('|');
Then it will give two values.
But suppose I have string like this
string str="This is very good string and every || bode can use it"
Now in this happened we will get three string's because we can not split this string based on || this .
for multiple charcter split you need to use this type of method
string str="This is very good string and every bode can use it"

string[] strPhrase = str.Split(new string[1] { "{every}" },StringSplitOptions.None);
string str1= strPhrase[0];


if this is not working then use this one

string[] res = str.Split(new string[] { "every" }, StringSplitOptions.None);
string str1 = res[1];


Now in this time we will retrieve two string after split based on "every".

Comments or Responses

Login to post response