exist?

exist?(pattern)
Instance Public methods

Looks ahead to see if the pattern exists anywhere in the string, without advancing the scan pointer. This predicates whether a scan_until will return a value.

s = StringScanner.new('test string')
s.exist? /s/            # -> 3
s.scan /test/           # -> "test"
s.exist? /s/            # -> 2
s.exist? /e/            # -> nil
doc_ruby_on_rails
2015-05-16 02:27:56
Comments
Leave a Comment

Please login to continue.