Пример #1
0
 /**
  * Parses number given as a string using provided format.
  *
  * @param string $numberToParse Number to be parsed
  * @param string $format Number format to use
  * @param \TYPO3\FLOW3\I18n\Locale $locale Locale to use
  * @param boolean $strictMode Work mode (strict when TRUE, lenient when FALSE)
  * @return mixed Parsed float number or FALSE on failure
  * @api
  */
 public function parseNumberWithCustomPattern($numberToParse, $format, \TYPO3\FLOW3\I18n\Locale $locale, $strictMode = TRUE)
 {
     return $this->doParsingWithParsedFormat($numberToParse, $this->numbersReader->parseCustomFormat($format), $this->numbersReader->getLocalizedSymbolsForLocale($locale), $strictMode);
 }
Пример #2
0
 /**
  * Returns number formatted by custom format, string provided in parameter.
  *
  * Format must obey syntax defined in CLDR specification, excluding
  * unimplemented features (see documentation for this class).
  *
  * Format is remembered in this classes cache and won't be parsed again for
  * some time.
  *
  * @param mixed $number Float or int, can be negative, can be NaN or infinite
  * @param string $format Format string
  * @param \TYPO3\FLOW3\I18n\Locale $locale A locale used for finding symbols array
  * @return string Formatted number. Will return string-casted version of $number if pattern is not valid / supported
  * @api
  */
 public function formatNumberWithCustomPattern($number, $format, \TYPO3\FLOW3\I18n\Locale $locale)
 {
     return $this->doFormattingWithParsedFormat($number, $this->numbersReader->parseCustomFormat($format), $this->numbersReader->getLocalizedSymbolsForLocale($locale));
 }