What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 28355 |  Welcome, Guest!   Register  Login
 Home > Code Snippets > C# > Split function for more than one parameter... ...
Kapildalke

Split function for more than one parameter...

 Code Snippet posted by: Kapildalke | Posted on: 5/26/2012 | Category: C# Codes | Views: 422 | Status: [Member] | Points: 40 | Alert Moderator   


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".
Found interesting? Add this to:


>> Write Response - Respond to this post and get points

More codes snippets

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/24/2013 3:54:42 AM