Thanks.  Will this work for a part of an element?  For example, lets say that I 
have 5 lines of characters in my array:

 

arr[0] = '12345'

arr[1] = '445566'

arr[2] = '4545543455'

arr[3] = '45367445'

arr[4] = '787873486895'

 

I want to look at each line, and determine which lines contains a certain 
string, and put those lines in a separate array.  So say for instance that I am 
looking for each line that has a '34' in it.  In this case, arr[0], arr[2], and 
arr[4] should be put into the second array.  How do I look for a part of an 
array element?  The code that you provided looks like it is looking at the 
element as a whole.  Thanks in advance for all of your help.

 

- Shelton


 
> Date: Mon, 23 Feb 2009 14:13:54 -0800
> Subject: [wtr-general] Re: Array Elements
> From: myrav...@gmail.com
> To: watir-general@googlegroups.com
> 
> 
> 
> second_array=[] ; first_array.each{|a| second_array << a if a =~ /
> expected_text/}
> 
> 
> On Feb 23, 3:53 pm, Jason Shelton <jas.shel...@hotmail.com> wrote:
> > All,
> >
> > I am reading an xml file into an array of lines(arr[]). I want to look at 
> > each individual line (element) of the array, and determine if the element 
> > contains a certain block of text. Is there a "contains_text" method, or 
> > something similiar, for array elements? I want to find all elements in the 
> > array that contain a certain block of text, and then make another array 
> > that is made of those array elements. Can anyone provide some help with 
> > this? Thanks in advance.
> >
> > - Shelton
> >
> > _________________________________________________________________
> > Windows Live™ Hotmail®:…more than just 
> > e-mail.http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_...
> > 

_________________________________________________________________
Windows Live™: Discover 10 secrets about the new Windows Live.  
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!7540.entry?ocid=TXT_TAGLM_WL_t2_ugc_post_022009
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to