Split a string in C#

For splitting a string use Split on strings

like

string url = "http://www.memorypointer.com";

string[] tokens = url.split('.');

tokens[0] will output

http://www

tokens[1] will output

memorypointer

and so on

Usage in foreach

string[] tokens = url.Split('.');
foreach (string block in tokens)
{
Response.Write(block);
}


Get Free Email Updates!

Signup now and receive free offers, discounts & coupon codes

I will never give away, trade or sell your email address. You can unsubscribe at any time.

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge