method
pointer
![Some documentation Importance_1](https://d2vfyqvduarcvs.cloudfront.net/images/importance_1.png?1349367920)
Ruby latest stable (v2_5_5)
-
0 notes -
Class: StringScanner
pointer()
public
Returns the byte position of the scan pointer. In the ‘reset’ position, this value is zero. In the ‘terminated’ position (i.e. the string is exhausted), this value is the bytesize of the string.
In short, it’s a 0-based index into bytes of the string.
s = StringScanner.new('test string') s.pos # -> 0 s.scan_until /str/ # -> "test str" s.pos # -> 8 s.terminate # -> #<StringScanner fin> s.pos # -> 11