[wtr-general] How to get numbers from String?

2010-02-19 Thread Prince3105
Hi All,

I am a watir newbie, its not a watir related question. Its a ruby
question. sorry for this.

I want to get the value 72 from below string.

Showing 1 to 10 of 72 Records


Please help me.


Thanks  Regards,

Prince3105

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


Re: [wtr-general] How to get numbers from String?

2010-02-19 Thread Željko Filipin
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