Re: Slicing Routine!
- From: "Daniel" <nospam@xxxxxxxxxxxxxx>
- Date: Mon, 29 Jan 2007 16:23:58 -0000
So whenever you get a 2 or a 1 you start a new bundle?
Just if statement it then a bit like this, very rough code:
foreach(int i in arr1)
{
if ( i>0 && i <= 2)
{
//check string array if its empty make a new one
//if it isnt add it to array and start new one
//add 1 or 2 to string array
}
else
{
//concat to string array all numbers after 1 or 2
}
}
return completeStringArray;
"Vai2000" <nospam@xxxxxxxxxxxxx> wrote in message
news:%23qmuSA8QHHA.2252@xxxxxxxxxxxxxxxxxxxxxxx
Hi All, I am looking for a smart solution to accomplish this task (.net
1.0)
Appreciate your input
I have a group of numbers in an arrayList
2,3,5,2,1,2,2
I need to output them into groups of
2,3,5
2
1
2
2
basically whenever I encounter 1 or 2 I bundle them up..
The numbers are in an arrayList, and I output them as string []
Arraylist Bundle(Arraylist)
{
// arr1 will contain (2,3,5)
alReturn.Add(arr1);
..................
return alReturn
}
TIA
.
- References:
- Slicing Routine!
- From: Vai2000
- Slicing Routine!
- Prev by Date: Program execution question - need guidance
- Next by Date: Re: If not CAB, then what?
- Previous by thread: Slicing Routine!
- Next by thread: Re: Slicing Routine!
- Index(es):