|
-
January 13th, 2010, 05:40 AM
#1
C# TextBox values to x string array
I have a textbox with the following values : 4,5,6,7,8,9,10,11,12,13,15
I want these values to be split into `x` string arrays with `y` values in each array.
For example extract into 3 arrays with 4 numbers in each :
int x = 3;
string[] batch;
batch[0] = "4,5,6,7"
batch[1] = "8,9,10,11"
batch[2] = "12,13,15"
For example extract into 5 arrays with 2 numbers in each :
int x = 5;
string[] batch;
batch[0] = "4,5"
batch[1] = "6,7"
batch[2] = "8,9"
batch[3] = "10,11"
batch[4] = "12,13"
batch[5] = "15"
I've tried Regex.split but I can't get it done... Please help
Tags for this Thread
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
|