how to split a string in c# with string delimiter

Smith
Smith
Participant
374 Points
112 Posts

Hi,

I want to split a string by a substring as

var temp= DeliveryAddress.Split( ":::" )[0];

but it throws error.

Please help.

Views: 8224
Total Answered: 1
Total Marked As Answer: 0
Posted On: 25-Sep-2015 00:10

Share:   fb twitter linkedin
Answers
NiceOne Team
NiceOne...
Admin
404 Points
67 Posts
         

Hi Smith,

Use following code:

var temp = DeliveryAddress.Split(new string[] { ":::" }, StringSplitOptions.None)[0];
//OR
var temp1 = DeliveryAddress.Split(new [] { ":::" }, StringSplitOptions.None)[0];
Posted On: 25-Sep-2015 03:41
 Log In to Chat