From 547865bc3d9fc0a4196f34a44d7968ea0cfdb4d9 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 22 Sep 2009 23:08:22 +0200 Subject: AS guide: documents String#first, and String#last --- railties/guides/source/active_support_overview.textile | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'railties/guides/source/active_support_overview.textile') 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" +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+ ... -- cgit v1.2.3