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

Параметры:
  • $sourcestring, php\io\Stream
  • $charsetstring, null - e.g.: UTF-8, windows-1251, etc., only for Stream objects
hasNext($pattern = null)
Параметры:
Результат:

bool

next($pattern = null)
Параметры:
Результат:

string, null null if doesn’t has the next pattern

nextLine()
Результат:string, null null if doesn’t has the next line
hasNextLine()
Результат:bool
nextInt($radix = null)
Параметры:
  • $radixnull, int - if null then uses the default radix
Результат:

int, null null if doesn’t has the next int

hasNextInt($radix = null)
Параметры:
  • $radixnull, int - if null then uses the default radix
Результат:

bool

nextDouble()
Результат:float, null null if does not has the next double
hasNextDouble()
Результат:bool
skip($pattern)
Параметры:
Результат:

bool true on success, false on fail

useDelimiter($delimiter)
Параметры:
Результат:

php\util\Scanner

useLocale($locale)
Параметры:
Результат:

php\util\Scanner

useRadix($value)
Параметры:
  • $valueint
Результат:

php\util\Scanner

getIOException()

Get the last io exception (if does not occur then returns null)

Результат:php\io\IOException, null
reset()
current()

Uses the result of the last called next() method

Результат:string
key()
Результат:int
valid()
Результат:bool
rewind()
__clone()

private