Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

split using string as delimiter 1

Status
Not open for further replies.

mp89

Programmer
Sep 17, 2004
35
GB
How do I do a split on a string using a string as the delimiter i.e. I want to split a string using a country code as the delimiter (e.g. 44, 49, 1, 358 etc).

strStartRange = '0' + strStartRange.Split(strCountryCode)[1];

Any help would be really appreciated.


Cheers,

Mike
 
One way would be to use a Regex Split.

string sPattern = "44";
string sInput = "joe 44 mary 44 sally 44 sue";
Regex regex = new Regex(sPattern);
Console.WriteLine(regex.Split(sInput)[1]);

output is mary

Marty
 
Thanks Marty.


Cheers,

Mike


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top