From b1409799f8b8cb355b71493d0724dc158aac9bec Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 22 Sep 2009 09:57:55 +0200 Subject: AS guide: documents String#at --- railties/guides/source/active_support_overview.textile | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'railties/guides') diff --git a/railties/guides/source/active_support_overview.textile b/railties/guides/source/active_support_overview.textile index d8f6b31a65..ca4d952c10 100644 --- a/railties/guides/source/active_support_overview.textile +++ b/railties/guides/source/active_support_overview.textile @@ -737,6 +737,19 @@ Ruby 1.8.7 and up define the iterator +String#each_char+ that understands UTF8 a "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E".each_char {|c| print c} # => 日本語 +h4. Access + +h5. +at(position)+ + +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 + + h3. Extensions to +Numeric+ ... -- cgit v1.2.3