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


PHP StringHelper::ucfirst方法代码示例

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


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

示例1: toArray

 public static function toArray($rawString)
 {
     while (strpos($rawString, "  ") !== false) {
         $rawString = str_replace("  ", " ", $rawString);
     }
     $arr = explode(' ', trim($rawString));
     $result["second_name"] = array_key_exists(0, $arr) ? trim(StringHelper::ucfirst($arr[0])) : null;
     $result["first_name"] = array_key_exists(1, $arr) ? trim(StringHelper::ucfirst($arr[1])) : null;
     $result["patronymic"] = array_key_exists(2, $arr) ? trim(StringHelper::ucfirst($arr[2])) : null;
     return $result;
 }
开发者ID:carono,项目名称:yii2-components,代码行数:11,代码来源:FioHelper.php

示例2: __construct

 public function __construct($rawData = [])
 {
     $nalog_info = \CArray::get($rawData, "nalog_info", []);
     $register_info = \CArray::get($rawData, "register_info", []);
     $address = \CArray::get($rawData, "address", []);
     $personal = \CArray::get($rawData, "personal", []);
     $names = \CArray::get($rawData, "names", []);
     $kapital = \CArray::get($rawData, "kapital", []);
     $trusted_personal = \CArray::get($rawData, "trusted_personal", []);
     $okved = \CArray::get($rawData, "okved", []);
     $termination = \CArray::get($rawData, "termination", []);
     $status = \CArray::get($rawData, "status", []);
     $this->rawData = $rawData;
     $this->inn = \CArray::get($nalog_info, 'inn');
     $this->ogrn = \CArray::get($register_info, 'ogrn');
     if ($address) {
         if (!($this->city = \CArray::get($address, 'town'))) {
             $this->city = \CArray::get($address, 'subdivision');
         }
         $this->city = \StringHelper::ucfirst(trim(str_replace('ГОРОД', "", $this->city)), true);
         unset($address["grn_and_date"]);
         $this->address = join(', ', $address);
     }
     if ($personal) {
         $secondname = \StringHelper::ucfirst(\CArray::get($personal, 'secondname'), true);
         $name = \StringHelper::ucfirst(\CArray::get($personal, 'name'), true);
         $patronymic = \StringHelper::ucfirst(\CArray::get($personal, 'patronymic'), true);
         $nameL = mb_substr($name, 0, 1, "UTF-8");
         $patronymicL = mb_substr($patronymic, 0, 1, "UTF-8");
         $this->full_name = join(' ', array_filter([$secondname, $name, $patronymic]));
         $this->short_name = join(' ', array_filter([$secondname, $nameL, $patronymicL]));
         $this->director = $this->full_name;
     } elseif ($names) {
         $this->full_name = \CArray::get($names, 'full_name');
         $this->short_name = \CArray::get($names, 'short_name');
     }
     $this->found = \CArray::get($kapital, 'size_rub');
     if ($trusted_personal) {
         $secondname = \StringHelper::ucfirst(\CArray::get($trusted_personal, 'secondname'), true);
         $name = \StringHelper::ucfirst(\CArray::get($trusted_personal, 'name'), true);
         $patronymic = \StringHelper::ucfirst(\CArray::get($trusted_personal, 'patronymic'), true);
         $this->director = join(' ', [$secondname, $name, $patronymic]);
     }
     $this->isOrganization = $trusted_personal || $names;
     $this->register_date = strtotime(\CArray::get($register_info, 'register_date'));
     $this->activity = \StringHelper::lower(\CArray::get($okved, 'code_activity'));
     if ($termination) {
         $this->status = self::STATUS_TERMINATED;
     } elseif ($status) {
         $this->status = \StringHelper::ucfirst(\CArray::get($status, 'status'), true);
     }
 }
开发者ID:carono,项目名称:company-info,代码行数:52,代码来源:CompanyData.php


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