PHP 클래스 Neos\Flow\I18n\Parser\NumberParser

This parser does not support full syntax of number formats as defined in CLDR. It uses parsed formats from NumbersReader class.
또한 보기: NumbersReader
파일 보기 프로젝트 열기: neos/flow-development-collection 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$numbersReader Neos\Flow\I18n\Cldr\Reader\NumbersReader

공개 메소드들

메소드 설명
injectNumbersReader ( NumbersReader $numbersReader ) : void
parseDecimalNumber ( string $numberToParse, Locale $locale, string $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT, boolean $strictMode = true ) : mixed Parses decimal number using proper format from CLDR.
parseNumberWithCustomPattern ( string $numberToParse, string $format, Locale $locale, boolean $strictMode = true ) : mixed Parses number given as a string using provided format.
parsePercentNumber ( string $numberToParse, Locale $locale, string $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT, boolean $strictMode = true ) : mixed Parses percent number using proper format from CLDR.

보호된 메소드들

메소드 설명
doParsingInLenientMode ( string $numberToParse, array $parsedFormat, array $localizedSymbols ) : mixed Parses number in lenient mode.
doParsingInStrictMode ( string $numberToParse, array $parsedFormat, array $localizedSymbols ) : mixed Parses number in strict mode.
doParsingWithParsedFormat ( string $numberToParse, array $parsedFormat, array $localizedSymbols, boolean $strictMode ) : mixed Parses number using parsed format, in strict or lenient mode.

메소드 상세

doParsingInLenientMode() 보호된 메소드

Lenient parsing ignores everything that can be ignored, and tries to extract number from the string, even if it's not well formed. Implementation is simple but should work more often than strict parsing. Algorithm: 1. Find first digit 2. Find last digit 3. Find decimal separator between first and last digit (if any) 4. Remove non-digits from integer part 5. Remove non-digits from decimal part (optional) 6. Try to match negative prefix before first digit 7. Try to match negative suffix after last digit
protected doParsingInLenientMode ( string $numberToParse, array $parsedFormat, array $localizedSymbols ) : mixed
$numberToParse string Number to be parsed
$parsedFormat array Parsed format (from NumbersReader)
$localizedSymbols array An array with symbols to use
리턴 mixed Parsed float number or FALSE on failure

doParsingInStrictMode() 보호된 메소드

In strict mode parser checks all constraints of provided parsed format, and if any of them is not fullfiled, parsing fails (FALSE is returned).
protected doParsingInStrictMode ( string $numberToParse, array $parsedFormat, array $localizedSymbols ) : mixed
$numberToParse string Number to be parsed
$parsedFormat array Parsed format (from NumbersReader)
$localizedSymbols array An array with symbols to use
리턴 mixed Parsed float number or FALSE on failure

doParsingWithParsedFormat() 보호된 메소드

Parses number using parsed format, in strict or lenient mode.
protected doParsingWithParsedFormat ( string $numberToParse, array $parsedFormat, array $localizedSymbols, boolean $strictMode ) : mixed
$numberToParse string Number to be parsed
$parsedFormat array Parsed format (from NumbersReader)
$localizedSymbols array An array with symbols to use
$strictMode boolean Work mode (strict when TRUE, lenient when FALSE)
리턴 mixed Parsed float number or FALSE on failure

injectNumbersReader() 공개 메소드

public injectNumbersReader ( NumbersReader $numbersReader ) : void
$numbersReader Neos\Flow\I18n\Cldr\Reader\NumbersReader
리턴 void

parseDecimalNumber() 공개 메소드

Parses decimal number using proper format from CLDR.
public parseDecimalNumber ( string $numberToParse, Locale $locale, string $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT, boolean $strictMode = true ) : mixed
$numberToParse string Number to be parsed
$locale Neos\Flow\I18n\Locale Locale to use
$formatLength string One of NumbersReader FORMAT_LENGTH constants
$strictMode boolean Work mode (strict when TRUE, lenient when FALSE)
리턴 mixed Parsed float number or FALSE on failure

parseNumberWithCustomPattern() 공개 메소드

Parses number given as a string using provided format.
public parseNumberWithCustomPattern ( string $numberToParse, string $format, Locale $locale, boolean $strictMode = true ) : mixed
$numberToParse string Number to be parsed
$format string Number format to use
$locale Neos\Flow\I18n\Locale Locale to use
$strictMode boolean Work mode (strict when TRUE, lenient when FALSE)
리턴 mixed Parsed float number or FALSE on failure

parsePercentNumber() 공개 메소드

Parses percent number using proper format from CLDR.
public parsePercentNumber ( string $numberToParse, Locale $locale, string $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT, boolean $strictMode = true ) : mixed
$numberToParse string Number to be parsed
$locale Neos\Flow\I18n\Locale Locale to use
$formatLength string One of NumbersReader FORMAT_LENGTH constants
$strictMode boolean Work mode (strict when TRUE, lenient when FALSE)
리턴 mixed Parsed float number or FALSE on failure

프로퍼티 상세

$numbersReader 보호되어 있는 프로퍼티

protected NumbersReader,Neos\Flow\I18n\Cldr\Reader $numbersReader
리턴 Neos\Flow\I18n\Cldr\Reader\NumbersReader