diff options
author | Xavier Noria <fxn@hashref.com> | 2009-09-22 23:08:22 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2009-09-22 23:09:31 +0200 |
commit | 547865bc3d9fc0a4196f34a44d7968ea0cfdb4d9 (patch) | |
tree | 2ab69f1a63685431bcb22022a3f46dd3dac979e3 /railties | |
parent | 76e4e686f99025a7fde612bd83080f9753159ae5 (diff) | |
download | rails-547865bc3d9fc0a4196f34a44d7968ea0cfdb4d9.tar.gz rails-547865bc3d9fc0a4196f34a44d7968ea0cfdb4d9.tar.bz2 rails-547865bc3d9fc0a4196f34a44d7968ea0cfdb4d9.zip |
AS guide: documents String#first, and String#last
Diffstat (limited to 'railties')
-rw-r--r-- | railties/guides/source/active_support_overview.textile | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/railties/guides/source/active_support_overview.textile b/railties/guides/source/active_support_overview.textile index b847e3b742..8e53672abd 100644 --- a/railties/guides/source/active_support_overview.textile +++ b/railties/guides/source/active_support_overview.textile @@ -772,6 +772,14 @@ Returns the substring of the string up to position +position+: "hello".to(10) # => "hello" </ruby> +h5. +first(limit = 1)+ + +The call +str.first(n)+ is equivalent to +str.to(n-1)+ if +n+ > 0, and returns an empty string for +n+ == 0. + +h5. +last(limit = 1)+ + +The call +str.last(n)+ is equivalent to +str.from(-n)+ if +n+ > 0, and returns an empty string for +n+ == 0. + h3. Extensions to +Numeric+ ... |