From: Viorel on
I have some names like aaxxbbyy where xx is '01'..'10' and yy is also
'01'..'10'. I think there is a simple, rubyst way of iterating through
them, and I ask for your help in finding it. Thank you in advance!
From: Robert Klemme on
On 08.05.2010 12:12, Viorel wrote:
> I have some names like aaxxbbyy where xx is '01'..'10' and yy is also
> '01'..'10'. I think there is a simple, rubyst way of iterating through
> them, and I ask for your help in finding it. Thank you in advance!

I am not sure I understand exactly what you are trying to do. Does this
help?

irb(main):005:0> r = '01' .. '10'
=> "01".."10"
irb(main):006:0> r.zip(r){|xx,yy| puts "aa#{xx}bb#{yy}"}
aa01bb01
aa02bb02
aa03bb03
aa04bb04
aa05bb05
aa06bb06
aa07bb07
aa08bb08
aa09bb09
aa10bb10
=> nil
irb(main):007:0>

Kind regards

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
From: Viorel on
On May 8, 5:28 pm, Robert Klemme <shortcut...(a)googlemail.com> wrote:
> On 08.05.2010 12:12, Viorel wrote:
>
> > I have some names like aaxxbbyy where xx is '01'..'10' and yy is also
> > '01'..'10'. I think there is a simple, rubyst way of iterating through
> > them, and I ask for your help in finding it. Thank you in advance!
>
> I am not sure I understand exactly what you are trying to do.  Does this
> help?
>
> irb(main):005:0> r = '01' .. '10'
> => "01".."10"
> irb(main):006:0> r.zip(r){|xx,yy| puts "aa#{xx}bb#{yy}"}
> aa01bb01
> aa02bb02
> aa03bb03
> aa04bb04
> aa05bb05
> aa06bb06
> aa07bb07
> aa08bb08
> aa09bb09
> aa10bb10
> => nil
> irb(main):007:0>
>
> Kind regards
>
>         robert
>
> --
> remember.guy do |as, often| as.you_can - without endhttp://blog.rubybestpractices.com/

Thank you, Robert! it is a begining, but I need somethink like:
aa01bb01
aa01bb02
aa01bb03
aa01bb04
..
..
..

aa02bb01
aa02bb02
aa02bb03
..
..
aa10bb09
aa10bb10
Can you help?
From: Robert Klemme on
On 05/08/2010 09:20 PM, Viorel wrote:
> On May 8, 5:28 pm, Robert Klemme <shortcut...(a)googlemail.com> wrote:
>> On 08.05.2010 12:12, Viorel wrote:
>>
>>> I have some names like aaxxbbyy where xx is '01'..'10' and yy is also
>>> '01'..'10'. I think there is a simple, rubyst way of iterating through
>>> them, and I ask for your help in finding it. Thank you in advance!
>> I am not sure I understand exactly what you are trying to do. Does this
>> help?
>>
>> irb(main):005:0> r = '01' .. '10'
>> => "01".."10"
>> irb(main):006:0> r.zip(r){|xx,yy| puts "aa#{xx}bb#{yy}"}
>> aa01bb01
>> aa02bb02
>> aa03bb03
>> aa04bb04
>> aa05bb05
>> aa06bb06
>> aa07bb07
>> aa08bb08
>> aa09bb09
>> aa10bb10
>> => nil
>> irb(main):007:0>
>>

> Thank you, Robert! it is a begining, but I need somethink like:
> aa01bb01
> aa01bb02
> aa01bb03
> aa01bb04
> .
> .
> .
>
> aa02bb01
> aa02bb02
> aa02bb03
> .
> .
> aa10bb09
> aa10bb10
> Can you help?

Where's the difference?

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
From: Viorel on
On May 9, 12:28 pm, Robert Klemme <shortcut...(a)googlemail.com> wrote:
> On 05/08/2010 09:20 PM, Viorel wrote:
>
>
>
>
>
> > On May 8, 5:28 pm, Robert Klemme <shortcut...(a)googlemail.com> wrote:
> >> On 08.05.2010 12:12, Viorel wrote:
>
> >>> I have some names like aaxxbbyy where xx is '01'..'10' and yy is also
> >>> '01'..'10'. I think there is a simple, rubyst way of iterating through
> >>> them, and I ask for your help in finding it. Thank you in advance!
> >> I am not sure I understand exactly what you are trying to do.  Does this
> >> help?
>
> >> irb(main):005:0> r = '01' .. '10'
> >> => "01".."10"
> >> irb(main):006:0> r.zip(r){|xx,yy| puts "aa#{xx}bb#{yy}"}
> >> aa01bb01
> >> aa02bb02
> >> aa03bb03
> >> aa04bb04
> >> aa05bb05
> >> aa06bb06
> >> aa07bb07
> >> aa08bb08
> >> aa09bb09
> >> aa10bb10
> >> => nil
> >> irb(main):007:0>
>
> > Thank you, Robert! it is a begining, but I need somethink like:
> >  aa01bb01
> >  aa01bb02
> >  aa01bb03
> >  aa01bb04
> > .
> > .
> > .
>
> >  aa02bb01
> >  aa02bb02
> >  aa02bb03
> > .
> > .
> >  aa10bb09
> >  aa10bb10
> > Can you help?
>
> Where's the difference?
>
>         robert
>
> --
> remember.guy do |as, often| as.you_can - without endhttp://blog.rubybestpractices.com/

The difference is that I have to iterate through yy for a given xx.
xx='01', yy='01'..'10', so I have 100 outputs, not only 10.