|
-
Mar 17th, 2005, 10:03 AM
#1
Thread Starter
New Member
Split question
I'd like to know how can I split a string with tabs as delimiters
I tried the following code
string inputString = "0\t100\t-5\t300\t500"; \\ \t are tabs
string delimStr ="\t";
char [] delimiter = delimStr.ToCharArray();
string [] split = input.Split(delimiter, x);
at this point, I expected the split array to contain the numbers separately (0, 100, -5, 300, and 500)
but instead the array only contains one element that is 0\t100\t-5\t300\t500
Any tips on this?
-
Mar 18th, 2005, 12:41 AM
#2
-
Mar 18th, 2005, 09:23 AM
#3
Thread Starter
New Member
Re: Split question
Hmm it's still not working
Am I missing something here?
Code:
string delimStr ="\\t";
-
Mar 18th, 2005, 09:54 AM
#4
Re: Split question
this works for me
Code:
string inputString = "0\t100\t-5\t300\t500";
char delimStr ='\t';
string[] split = inputString.Split(delimStr);
-
Mar 18th, 2005, 10:03 AM
#5
Thread Starter
New Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|