[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Regular Expression question

Kristen

6/30/2007 2:32:00 AM

Hello,

Im working with regular expressions and I cant quite understand how the
"13" is extracted from the string.


Here is the irb output:
irb(main):005:0> "(13)"[1..-2].to_i
=> 13


I dont understadn how the [1..-2] parameter removes the parenthases from
the string.


Could someone please explain.

Thanks in advance.

--
Posted via http://www.ruby-....