You are here

public function LegacyNumberFormatter::parseCurrency in Price 3.x

Same name and namespace in other branches
  1. 8 src/LegacyNumberFormatter.php \Drupal\price\LegacyNumberFormatter::parseCurrency()
  2. 3.0.x src/LegacyNumberFormatter.php \Drupal\price\LegacyNumberFormatter::parseCurrency()

Parses a formatted currency amount.

Parameters

string $number: The formatted number.

\Drupal\price\Entity\CurrencyInterface $currency: The currency.

Return value

string|false The parsed currency amount, or FALSE on failure.

File

src/LegacyNumberFormatter.php, line 92

Class

LegacyNumberFormatter
Provides a legacy number formatter for the deprecated NumberFormatterFactory.

Namespace

Drupal\price

Code

public function parseCurrency($number, CurrencyInterface $currency) {
  return $this->currencyFormatter
    ->parse($number, $currency
    ->id());
}