Method: Klam::Primitives::Strings#pos

Defined in:
lib/klam/primitives/strings.rb

#pos(str, n) ⇒ Object



4
5
6
7
8
9
# File 'lib/klam/primitives/strings.rb', line 4

def pos(str, n)
  if n < 0 || n >= str.length
    ::Kernel.raise ::Klam::Error, "index out of bounds: #{n}"
  end
  str[n]
end