Метод |
Описание |
|
__construct ( string $str, string $encoding = null ) |
Creates a new StringScanner object to scan over the given $string. |
|
check ( string $pattern ) |
This returns the value that scan would return, without advancing the scan pointer. The match register is affected, though. |
|
checkUntil ( string $pattern ) : string |
This returns the value that {@link scanUntil()} would return, without advancing the scan @mlink{$pointer}. |
|
concat ( $str ) |
Appends $str to the @mlink{$string} being scanned. |
|
exist ( string $pattern ) |
Looks ahead to see if the $pattern exists anywhere in the @mlink{$string}, without advancing the scan @mlink{$pointer}. |
|
getMatched ( ) : string |
Returns the last matched string. |
|
getMatchedSize ( ) : integer |
Returns the size of the most recent match (see matched), or null if there was no recent match. |
|
getPos ( ) : integer |
Returns the character position of the scan @mlink{$pointer}. In the '{@link reset() reset}' position, this
value is zero. In the '{@link terminate() terminated}' position (i.e. the string is exhausted),
this value is the size of the @mlink{$string}. |
|
getPostMatch ( ) : string |
Return the post-match (in the regular expression sense) of the last scan. |
|
getPreMatch ( ) : string |
Return the pre-match (in the regular expression sense) of the last scan. |
|
getRest ( ) : string |
Returns the "rest" of the string (i.e. everything after the scan pointer). |
|
getScanned ( ) : string |
Returns the last matched string. |
|
getString ( ) : string |
Returns the string being scanned. |
|
getch ( ) |
Scans one character and returns it. This method is multibyte character sensitive. |
|
inspect ( ) |
Returns a string that represents the StringScanner object, showing:
- the current position
- the size of the string
- the characters surrounding the scan pointer |
|
isBeginningOfLine ( ) : boolean |
Returns true if the scan @mlink{$pointer} is at the beginning of the line. |
|
match ( string $pattern ) : integer |
Tests whether the given $pattern is matched from the current scan @mlink{$pointer}. |
|
matched ( ) : boolean |
Returns true if the last match was successful. |
|
offsetExists ( integer $offset ) |
Wether the n-th group was caught or not in the last match. |
|
offsetGet ( integer $offset ) |
Implements ArrayAccess
Return the n-th subgroup in the most recent match. |
|
offsetSet ( $offset, $value ) |
Calling this method will throw an exception. |
|
offsetUnset ( $offset ) |
Calling this method will throw an exception. |
|
peek ( $len ) : string |
Extracts a string corresponding to mb_substr(@mlink{$rest}, 0, $len), without
advancing the scan pointer. |
|
reset ( ) |
Reset the scan pointer (index 0) and clear matching data. |
|
restSize ( ) |
$s->restSize() is equivalent to mb_strlen($s->rest) |
|
scan ( string $pattern ) |
Tries to match with $pattern at the current position. If there's a match,
the scanner advances the scan @mlink{$pointer} and returns the matched string. |
|
scanFull ( string $pattern, boolean $advance_pointer, boolean $return_string ) : mixed |
Tests whether the given +pattern+ is matched from the current scan pointer. |
|
scanUntil ( string $pattern ) : string |
Scans the string _until_ the +pattern+ is matched. Returns the substring up
to and including the end of the match, advancing the scan pointer to that
location. If there is no match, +null+ is returned. |
|
searchFull ( string $pattern, boolean $advance_pointer, boolean $return_string ) : mixed |
Scans the string _until_ the $pattern is matched. |
|
setPointer ( integer $i ) : integer |
Set the byte position of the scan pointer. |
|
setPos ( integer $i ) : integer |
Same as {@link setPointer()}
Set the byte position of the scan pointer. |
|
setString ( string $str ) : string |
Changes the string being scanned to +str+ and resets the scanner. |
|
skip ( string $pattern ) : integer |
Attempts to skip over the given +pattern+ beginning with the scan pointer. |
|
skipUntil ( string $pattern ) : string |
Advances the scan pointer until +pattern+ is matched and consumed. Returns
the number of bytes advanced, or +null+ if no match was found. |
|
terminate ( ) |
Set the scan pointer to the end of the string and clear matching data. |
|
unscan ( ) |
Set the scan pointer to the previous position. Only one previous position is
remembered, and it changes with each scanning operation. |
|