## gp04lch

hi people,

I'm supposed to be creating something like a dynamic item number generator.

for example:

FROM: A 1 0 111
TO: B 2 0 112

should produce:
A 1 0 111
A 1 0 112
B 1 0 111
B 1 0 112

this would be quite easy using 4 for loops but the problem is the user should be able to control the length of the input. they can specify how long they want the numbers to be:

length [5]
FROM: A 1 0 1 111
TO: B 1 0 1 112

or

length [7]
FROM: A 1 0 1 111 A 1
TO: B 1 0 1 111 B 2

you get the picture. I'm really stumped and do not know what to do. any help would be really appreciated. thanks!

## LizR 171

So, you need to split the string into chunks and work by value, and then go from 'start' to 'end' for each one.

## gp04lch

yes i thought of that concept too. but how do i go about defining how many loops i need? its dynamic and therefore not fixed.

i'd really appreciate it if you can provide me with an example.

## selvaganapathy 31

Hi,
Array size can be specified dynamically like

``````int[] AnArray;
int iSize = 10;

AnArray = new int [iSize];``````

So user can control the length

## gp04lch

thanks for the reply. but i'm actually not talking about that problem. what i meant was:

1. how do i make my loops depth follow the width of the array?
2. (new question) how do i differentiate between numbers and characters and place them in the loops?

## LizR 171

heres some psudo code
begin
split string get bunch of chunks
define output area
dostuff(chunks)
end

proc dostuff(chunks)
take first chunk
for all the bits of last chunk
for all the output areas
make a copy of current output area + bit
dostuff(chunks - current chunk)
end

## gp04lch

i almost got it. but i cant seem to do the copy part.
here's my code:

``````public void GenerateCode(string[,] segmentList)
{
for (int i = intfrom; i <= intto; i++)
{
GenerateCode(newsegment minus one row of segmentlist);
//here's the problem, how do i get 'i' to be passed into the method above?
}
}``````

## LizR 171

You dont need to send I at all.

## gp04lch

ok i got it! thanks for the pseudo code