instance method
at
Ruby on Rails 3.0.20
Since v3.0.20Signature
at(position)
Returns the character at the position treating the string as an array (where 0 is the first character).
Examples:
"hello".at(0) # => "h" "hello".at(4) # => "o" "hello".at(10) # => ERROR if < 1.9, nil in 1.9
Parameters
-
positionreq
Source
# File activesupport/lib/active_support/core_ext/string/access.rb, line 11
def at(position)
mb_chars[position, 1].to_s
end
Defined in activesupport/lib/active_support/core_ext/string/access.rb line 11
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in String