Method: Rex::Text.pattern_offset
- Defined in:
- lib/rex/text/pattern.rb
.pattern_offset(pattern, value, start = 0) ⇒ Integer?
Calculate the offset to a pattern
73 74 75 76 77 78 79 80 81 |
# File 'lib/rex/text/pattern.rb', line 73 def self.pattern_offset(pattern, value, start=0) if value.kind_of?(String) pattern.index(value, start) elsif value.kind_of?(Integer) pattern.index([ value ].pack('V'), start) else raise ::ArgumentError, "Invalid class for value: #{value.class}" end end |