View Single Post
  #9 (permalink)  
Old 03-31-2008, 09:55 PM
shaalini shaalini is offline
D-Web Analyst
 
Join Date: Apr 2007
Posts: 342
shaalini is on a distinguished road
Default Re: Ruby BuiltIn functions

chomp
chomp( [ aString ] ) -> $_ or aString
Equivalent to $_ = $_.chomp(aString). See String#chomp on page 367.

$_ = "now\n"
chomp » "now"
$_»"now"
chomp "ow"»"n"
$_ »"n"
chomp "xxx"»"n"
$_»"n"

chomp!
chomp!( [ aString ] ) -> $_ or nil


Equivalent to $_.chomp!(aString). See String#chomp!

$_ = "now\n"
chomp! » "now"
$_»"now"
chomp! "x"»nil
$_ » "now"
__________________
Shaalini.S
Be the Best of Whatever you are...
Reply With Quote