Hi Željko,

Thanks for your instant reply. I got some a handy solution by
googling.

str = "Showing 1 to 10 of 72 Records"

total_number_of_records = str.scan(/\d+/)[2].to_i


Again thanks,

Prince3105

On Feb 19, 3:36 pm, Željko Filipin <zeljko.fili...@wa-research.ch>
wrote:
> On Fri, Feb 19, 2010 at 11:22 AM, Prince3105 <prince3...@gmail.com> wrote:
> > Its a ruby
> > question. sorry for this.
> > I want to get the value "72" from below string.
> > "Showing 1 to 10 of 72 Records"
>
> Ruby questions are welcome here. Although, you could get better answers at
> ruby list.
>
> This is one way. Let me know if you do not understand it.
>
> $ irb>> "Showing 1 to 10 of 72 Records".split(" ")
>
> => ["Showing", "1", "to", "10", "of", "72", "Records"]>> "Showing 1 to 10 of 
> 72 Records".split(" ")[5]
> => "72"
> >> "Showing 1 to 10 of 72 Records".split(" ")[5].to_i
>
> => 72
>
> More information:
>
> http://ruby-doc.org/core/classes/String.html
>
> Željko
> --
> watir.com - community manager
> pledgie.com/campaigns/2982 - donate to Watir
> watirpodcast.com - host
> testingpodcast.com - podcasts on software testing. all of them

-- 
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