instance method
StringScanner#pointer
() -> ::Integer
pointer
ext/strscan/strscan.c
View on GitHub ↗
static VALUE
strscan_get_pos(VALUE self)
{
struct strscanner *p;
GET_SCANNER(self, p);
return LONG2NUM(p->curr);
}
Alias of #pos
call-seq: pos -> byte_position
Returns the integer byte position, which may be different from the character position:
Example
scanner = StringScanner.new(HIRAGANA_TEXT) scanner.string # => "こんにちは" scanner.pos # => 0 scanner.getch # => "こ" # 3-byte character. scanner.charpos # => 1 scanner.pos # => 3