From 6aa959e7fc6fd26201e57ff7f498edaf323cb014 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 22 Sep 2009 10:04:41 +0200 Subject: AS guide: documents String#to and fixes examples --- .../guides/source/active_support_overview.textile | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'railties/guides') 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 + + +h5. +from(position)+ + +Returns the substring of the string starting at position +position+: + + +"hello".from(0) # => "hello" +"hello".from(2) # => "llo" +"hello".from(-2) # => "lo" +"hello".from(10) # => "" + + +h5. +to(position)+ + +Returns the substring of the string up to position +position+: + + +"hello".to(0) # => "h" +"hello".to(2) # => "hel" +"hello".to(-2) # => "hell" +"hello".to(10) # => "hello" h3. Extensions to +Numeric+ -- cgit v1.2.3