當前位置: 首頁>>代碼示例>>PHP>>正文


PHP NumberFormatter::getPattern方法代碼示例

本文整理匯總了PHP中NumberFormatter::getPattern方法的典型用法代碼示例。如果您正苦於以下問題:PHP NumberFormatter::getPattern方法的具體用法?PHP NumberFormatter::getPattern怎麽用?PHP NumberFormatter::getPattern使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NumberFormatter的用法示例。


在下文中一共展示了NumberFormatter::getPattern方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: currency_side

function currency_side()
{
    $config = get_instance()->config;
    $fmt = new \NumberFormatter($config->item('number_locale'), \NumberFormatter::CURRENCY);
    $fmt->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, $config->item('currency_symbol'));
    return !preg_match('/^¤/', $fmt->getPattern());
}
開發者ID:mnapier,項目名稱:opensourcepos,代碼行數:7,代碼來源:locale_helper.php

示例2: moneda

 public static function moneda($entero, $localidad = null, $codigo = null)
 {
     if (empty($entero)) {
         return $entero;
     }
     $localidad = empty($localidad) ? self::LOCALIDAD_RD : $localidad;
     $codigo = empty($codigo) ? self::CODIGO_RD : $codigo;
     $sufijo = $localidad == 'es_DO' ? 'RD' : '';
     $fmt = new NumberFormatter($localidad, NumberFormatter::CURRENCY);
     //$fmt->setTextAttribute(NumberFormatter::CURRENCY_CODE, 'DOP');
     $fmt->setPattern(str_replace('¤#', '¤ #', $fmt->getPattern()));
     return $sufijo . $fmt->formatCurrency($entero, $codigo);
     //setlocale(LC_MONETARY, $localidad);
     //return money_format('%i', $entero) . "\n";
 }
開發者ID:alejandrososa,項目名稱:ventasYii,代碼行數:15,代碼來源:FormatoHelper.php

示例3: getPattern

 /**
  * Pattern espositivo della valuta
  *
  * @return bool|string
  */
 public function getPattern()
 {
     $nft = new NF($this->locale, NF::CURRENCY);
     return $nft->getPattern();
 }
開發者ID:beggiatom,項目名稱:L5Intl,代碼行數:10,代碼來源:Currency.php

示例4: nReal

 /**
  * Mostra o Valor no real Formatado
  * @param float $number
  * @param boolean $fixed
  * @param boolean $symbol
  * @param integer $decimals
  * @return string
  */
 public static function nReal($number, $decimals = 2, $symbol = true, $fixed = true)
 {
     if (is_null($number) || empty(self::onlyNumbers($number))) {
         return '';
     }
     $formater = new \NumberFormatter("pt-BR", \NumberFormatter::CURRENCY);
     $formater->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, $fixed ? $decimals : 1);
     if ($decimals === false) {
         $decimals = 2;
         preg_match_all('/[0-9][^0-9]([0-9]+)/', $number, $matches);
         if (!empty($matches[1])) {
             $decimals = strlen(rtrim($matches[1][0], 0));
         }
     }
     $formater->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, $decimals);
     if (!$symbol) {
         $pattern = preg_replace("/[¤]/", '', $formater->getPattern());
         $formater->setPattern($pattern);
     } else {
         // ESPAÇO DEPOIS DO SIMBOLO
         $pattern = str_replace("¤", "¤ ", $formater->getPattern());
         $formater->setPattern($pattern);
     }
     return $formater->formatCurrency($number, $formater->getTextAttribute(\NumberFormatter::CURRENCY_CODE));
 }
開發者ID:eduardokum,項目名稱:laravel-boleto,代碼行數:33,代碼來源:Util.php


注:本文中的NumberFormatter::getPattern方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。