StringScanner Reference Manual
Class Methods
- new( string )
-
create new StringScanner object. 'str' is string to scan.
Methods
- scan( regex: Regexp ): String
-
do match with 'regex'.
if match, make "scan pointer" forward and return matched string.
else return nil.
- skip( regex : Regexp ) : Integer
-
do match with 'regex'.
if match, make "scan pointer" forward and return length of matched string.
else return nil.
- match?( regex: Regexp ): Boolean
-
do match with 'regex'.
if match, keep "scan pointer" untouch and return length of matched string.
else return nil.
- fullscan( regex: Regexp, makestr_p: Boolean, fwdptr_p: Boolean ): Object
-
do match with 'regex'.
if match then
if fwdptr_p then forward pointer else keep untouch end
return (makestr_p ? matched string : length of matched string)
else
return nil
end
- getch : String
-
return 1 byte which is pointed by "scan pointer", and make pointer forward.
- rest : String
-
return string after the byte which is pointed by "scan pointer".
- rest? : Boolean
-
return true if un-scanned string exists.
- restsize : Integer
-
length of 'rest' string
- unscan
-
set "scan pointer" back for one times.
more than one times of 'unscan' for one 'scan' (or skip or...) raises ScanError.
- matched
-
return previous matching string.
It may done with 'scan' or 'skip'. 'match?' is not because 'match?' won't make
"scan pointer" forward.
- matchedsize
-
returns length of 'matched' string.
- self[n]
-
returns N-th content of regexp register (it is indecated by paren).
"strscan[0]" is equals to "strscan.matched".
Copyright (c) 1999,2000 Minero Aoki
<aamine@dp.u-netsurf.ne.jp>