diff options
author | Xavier Noria <fxn@hashref.com> | 2009-09-22 10:04:41 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2009-09-22 23:09:30 +0200 |
commit | 6aa959e7fc6fd26201e57ff7f498edaf323cb014 (patch) | |
tree | 7fa70b62474bfc86038162c5a8df16e663242b19 /railties/guides/source | |
parent | b1409799f8b8cb355b71493d0724dc158aac9bec (diff) | |
download | rails-6aa959e7fc6fd26201e57ff7f498edaf323cb014.tar.gz rails-6aa959e7fc6fd26201e57ff7f498edaf323cb014.tar.bz2 rails-6aa959e7fc6fd26201e57ff7f498edaf323cb014.zip |
AS guide: documents String#to and fixes examples
Diffstat (limited to 'railties/guides/source')
-rw-r--r-- | railties/guides/source/active_support_overview.textile | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/railties/guides/source/active_support_overview.textile b/railties/guides/source/active_support_overview.textile index ca4d952c10..70aeddf226 100644 --- a/railties/guides/source/active_support_overview.textile +++ b/railties/guides/source/active_support_overview.textile @@ -747,7 +747,29 @@ Returns the character of the string at position +position+: "hello".at(0) # => "h" "hello".at(4) # => "o" "hello".at(-1) # => "o" -"hello".at(10) # => nil +"hello".at(10) # => ERROR +</ruby> + +h5. +from(position)+ + +Returns the substring of the string starting at position +position+: + +<ruby> +"hello".from(0) # => "hello" +"hello".from(2) # => "llo" +"hello".from(-2) # => "lo" +"hello".from(10) # => "" +</ruby> + +h5. +to(position)+ + +Returns the substring of the string up to position +position+: + +<ruby> +"hello".to(0) # => "h" +"hello".to(2) # => "hel" +"hello".to(-2) # => "hell" +"hello".to(10) # => "hello" </ruby> h3. Extensions to +Numeric+ |