C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...







How to use the Regex.Split() to split strings in C# ?


Posted Date: 18 Jun 2007    Resource Type: Code Snippets    Category: Regular Expressions

Posted By: Abhishek Arya       Member Level: Diamond
Rating:     Points: 10



As you might know the string Split method allows you to split a string only be a specified character. If you wish to split a string using the power of the regular expressions to specify the delimiter a good solution is to use the Regex.Split() method


using System.Text;
using System.Text.RegularExpressions;

...

string strText=" DotnetSpider@@ Spider@@ Is @@ Good @@ for @@ Learner ";

foreach(string strItem in Regex.Split(strText,"@@")){
Console.WriteLine(strItem);
}




will print:

Dotnet
Spider
Good
for
Learner




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Split function  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Strip HTML tags from string
Previous Resource: ValidateExpression for Day,Month and Year
Return to Discussion Resource Index
Post New Resource
Category: Regular Expressions


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

web conferencing services

Contact Us    Privacy Policy    Terms Of Use