StringScanner

StringScanner

ri

 --------------------------------------------------- Class: StringScanner
      StringScanner provides for lexical scanning operations on a String.
      Here is an example of its usage:
 
        s = StringScanner.new('This is an example string')
        s.eos?               # -> false
      
        p s.scan(/\w /)      # -> "This"
        p s.scan(/\w /)      # -> nil
        p s.scan(/\s /)      # -> " "
        p s.scan(/\s /)      # -> nil
        p s.scan(/\w /)      # -> "is"
        s.eos?               # -> false
      
        p s.scan(/\s /)      # -> " "
        p s.scan(/\w /)      # -> "an"
        p s.scan(/\s /)      # -> " "
        p s.scan(/\w /)      # -> "example"
        p s.scan(/\s /)      # -> " "
        p s.scan(/\w /)      # -> "string"
        s.eos?               # -> true
      
        p s.scan(/\s /)      # -> nil
        p s.scan(/\w /)      # -> nil
 
      Scanning a string means remembering the position of a _scan
      pointer_, which is just an index. The point of scanning is to move
      forward a bit at a time, so matches are sought after the scan
      pointer
		
  • 2006/05/12 19:52:55 <<
  • 2006/05/15 12:03:11 at
  • 2006/05/15 12:08:19 clear
  • 2006/05/15 12:10:41 concat
  • 2006/05/15 12:17:09 empty?
  • 2006/05/15 12:19:54 exist?
  • 2006/05/15 12:26:19 getc
  • 2006/05/15 12:32:31 inspect
  • 2006/05/15 12:37:25 line
  • 2006/05/15 12:40:07 match
  • 2006/05/15 12:41:16 min
  • 2006/05/15 12:42:14 new
  • 2006/05/15 12:46:23 pos
  • 2006/05/15 12:46:31 pos=
  • 2006/05/15 12:54:09 scan
  • 2006/05/15 12:56:40 size
  • 2006/05/15 12:56:55 skip
  • 2006/05/15 13:00:35 str
  • 2006/05/15 11:49:22 StringScanner
  • 2006/05/15 13:06:34 tr