Ask a Question related to ASP.NET General, Design and Development.
-
Mark Fox #1
Delimiter Split
Hello,
The string.Split method is very useful for splitting
strings that use a single character as a delimiter. i.e.:
string str = "First;Second;Third";
string[] strArray = str.Split(new char[] {';'});
But I am having trouble getting the Split method to split
a string with a delimiter of more than one character.
What is the correct syntax?
string str = "First<;>Second<;>Third";
// This does not work, it gives an "Unhandled Exception
// of type 'System.ExecutionEngineException' in
// mscorlib.dll"
string[] strArray = str.Split(new char[] {'<',';','>'});
Thanks!
Mark Fox Guest
-
#39306 [NEW]: Changing Delimiter
From: ctingley at mediagrids dot com Operating system: Windows PHP version: 5.1.6 PHP Bug Type: MySQL related Bug... -
Delimiter for string..
Friends, I am running a perl script as below which is working perfectly and want to replace the hardcoded values with variables. (the script... -
Splitting and keeping the delimiter
Hello! I have a string like this: 12.00 Simpsons 12.30 Seinfeld 13.00 Movie: Dante's Peak And I want to split that in seperate "programs" that... -
Delimiter WITHOUT lots of IF's
Hi all, I need to create an automatic process for visitors who are adding items into a shopping cart, be able to see how many MBs and how many... -
Regex help (? as delimiter)
Lawrence Tierney wrote: --------------^ No it doesn't. Exchange \d for \w and it matches. -- Gunnar Hjalmarsson -
Natty Gur #2
Re: Delimiter Split
Hi,
the relationship between chars is OR and not AND.
[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/h[/url]
tml/frlrfsystemstringclasssplittopic1.asp
Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest
-
Chris R. Timmons #3
Re: Delimiter Split
"Mark Fox" <info@solelsoftware.com> wrote in
news:026901c35f98$5abb7c10$a101280a@phx.gbl:
Mark,> Hello,
>
> The string.Split method is very useful for splitting
> strings that use a single character as a delimiter. i.e.:
>
> string str = "First;Second;Third";
>
> string[] strArray = str.Split(new char[] {';'});
>
> But I am having trouble getting the Split method to split
> a string with a delimiter of more than one character.
> What is the correct syntax?
>
> string str = "First<;>Second<;>Third";
>
> // This does not work, it gives an "Unhandled Exception
> // of type 'System.ExecutionEngineException' in
> // mscorlib.dll"
> string[] strArray = str.Split(new char[] {'<',';','>'});
To split on multiple characters, use the Regex.Split method:
using System.Text.RegularExpressions;
...
string str = "First<;>Second<;>Third";
string[] strArray = Regex.Split(str, "<;>");
Hope this helps.
Chris.
-------------
C.R. Timmons Consulting, Inc.
[url]http://www.crtimmonsinc.com/[/url]
Chris R. Timmons Guest



Reply With Quote

