Method: String#equal_at

Defined in:
lib/meta_parse.rb

#equal_at(position, string, position2 = 0) ⇒ Object

Returns true iff receiver (String) is equal to string at index, position, of receiver. If position2 is supplied, begin comparison of string at that index position.



458
459
460
461
462
463
464
# File 'lib/meta_parse.rb', line 458

def equal_at(position, string, position2=0)
  for i in position2..(position2 + string.length - 1) do
    return nil unless self[position] == string[i] 
    position += 1
  end
  return true
end