Scanner¶
-
php\util\Scanner
implements: Iterator
A simple text scanner which can parse primitive types and strings using regular expressions.
Class Scanner
Methods
__construct
($source, $charset = null)¶throws php\lang\IllegalArgumentException if $charset is invalid
Parameters:
- $source – string, php\io\Stream
- $charset – string, null - e.g.: UTF-8, windows-1251, etc., only for Stream objects
hasNext
($pattern = null)¶
Parameters:
- $pattern – php\util\Regex
Returns: bool
next
($pattern = null)¶
Parameters:
- $pattern – php\util\Regex
Returns: string, null null if doesn’t has the next pattern
nextLine
()¶
Returns: string, null null if doesn’t has the next line
hasNextLine
()¶
Returns: bool
nextInt
($radix = null)¶
Parameters:
- $radix – null, int - if null then uses the default radix
Returns: int, null null if doesn’t has the next int
hasNextInt
($radix = null)¶
Parameters:
- $radix – null, int - if null then uses the default radix
Returns: bool
nextDouble
()¶
Returns: float, null null if does not has the next double
hasNextDouble
()¶
Returns: bool
skip
($pattern)¶
Parameters:
- $pattern – php\util\Regex
Returns: bool
true
on success,false
on fail
useDelimiter
($delimiter)¶
Parameters:
- $delimiter – php\util\Regex
Returns:
useLocale
($locale)¶
Parameters:
- $locale – php\util\Locale
Returns:
useRadix
($value)¶
Parameters:
- $value – int
Returns:
getIOException
()¶Get the last io exception (if does not occur then returns
null
)
Returns: php\io\IOException, null
reset
()¶
current
()¶Uses the result of the last called
next()
method
Returns: string
key
()¶
Returns: int
valid
()¶
Returns: bool
rewind
()¶
__clone
()¶private