当前位置: 首页>>代码示例>>PHP>>正文


PHP sfCultureInfo::getNumberFormat方法代码示例

本文整理汇总了PHP中sfCultureInfo::getNumberFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP sfCultureInfo::getNumberFormat方法的具体用法?PHP sfCultureInfo::getNumberFormat怎么用?PHP sfCultureInfo::getNumberFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfCultureInfo的用法示例。


在下文中一共展示了sfCultureInfo::getNumberFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInstance

 /**
  * Returns the sfNumberFormatInfo associated with the specified culture.
  *
  * @param sfCultureInfo the culture that gets the sfNumberFormat property.
  * @param int the number formatting type, it should be 
  * sfNumberFormatInfo::DECIMAL, sfNumberFormatInfo::CURRENCY,
  * sfNumberFormatInfo::PERCENTAGE, or sfNumberFormatInfo::SCIENTIFIC
  * @return sfNumberFormatInfo sfNumberFormatInfo for the specified culture.
  * @see getCurrencyInstance();
  * @see getPercentageInstance();
  * @see getScientificInstance();
  */
 public static function getInstance($culture = null, $type = sfNumberFormatInfo::DECIMAL)
 {
     if ($culture instanceof sfCultureInfo) {
         $formatInfo = $culture->getNumberFormat();
         $formatInfo->setPattern($type);
         return $formatInfo;
     } else {
         if (is_string($culture)) {
             $sfCultureInfo = new sfCultureInfo($culture);
             $formatInfo = $sfCultureInfo->getNumberFormat();
             $formatInfo->setPattern($type);
             return $formatInfo;
         } else {
             $sfCultureInfo = new sfCultureInfo();
             $formatInfo = $sfCultureInfo->getNumberFormat();
             $formatInfo->setPattern($type);
             return $formatInfo;
         }
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:32,代码来源:sfNumberFormatInfo.class.php

示例2: simplify

}
// ->getDateTimeFormat()
$t->diag('->getDateTimeFormat()');
$c = new sfCultureInfo();
$t->isa_ok($c->getDateTimeFormat(), 'sfDateTimeFormatInfo', '->getDateTimeFormat() returns a sfDateTimeFormatInfo instance');
// ->setDateTimeFormat()
$t->diag('->setDateTimeFormat()');
$d = $c->getDateTimeFormat();
$c->setDateTimeFormat('yyyy');
$t->is($c->getDateTimeFormat(), 'yyyy', '->setDateTimeFormat() sets the sfDateTimeFormatInfo instance');
$c->DateTimeFormat = 'mm';
$t->is($c->getDateTimeFormat(), 'mm', '->setDateTimeFormat() is equivalent to ->DateTimeFormat = ');
// ->getNumberFormat()
$t->diag('->getNumberFormat()');
$c = new sfCultureInfo();
$t->isa_ok($c->getNumberFormat(), 'sfNumberFormatInfo', '->getNumberFormat() returns a sfNumberFormatInfo instance');
// ->setNumberFormat()
$t->diag('->setNumberFormat()');
$d = $c->getNumberFormat();
$c->setNumberFormat('.');
$t->is($c->getNumberFormat(), '.', '->setNumberFormat() sets the sfNumberFormatInfo instance');
$c->NumberFormat = '#';
$t->is($c->getNumberFormat(), '#', '->setNumberFormat() is equivalent to ->NumberFormat = ');
// ->simplify()
$t->diag('->simplify()');
class myCultureInfo extends sfCultureInfo
{
    public static function simplify($array)
    {
        return parent::simplify($array);
    }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:31,代码来源:sfCultureInfoTest.php


注:本文中的sfCultureInfo::getNumberFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。