Skip to content
class method

StringScanner.new

(::String, ?bool dup, ?fixed_anchor: bool) -> ::StringScanner
StringScanner.new(string, fixed_anchor: false) → string_scanner

Returns a new StringScanner object whose stored string is the given string; sets the fixed-anchor property:

Example
scanner = StringScanner.new('foobarbaz')
scanner.string        # => "foobarbaz"
scanner.fixed_anchor? # => false
put_situation(scanner)
# Situation:
#   pos:       0
#   charpos:   0
#   rest:      "foobarbaz"
#   rest_size: 9
See also #<< #[] also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0