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


PHP CString::endsWith方法代码示例

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


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

示例1: storageUnitFromOptionValue

 protected static function storageUnitFromOptionValue($optionValue)
 {
     $optionValue = CString::toLowerCase($optionValue);
     if (CString::endsWith($optionValue, "k")) {
         return CUUnit::KILOBYTE;
     }
     if (CString::endsWith($optionValue, "m")) {
         return CUUnit::MEGABYTE;
     }
     if (CString::endsWith($optionValue, "g")) {
         return CUUnit::GIGABYTE;
     }
     if (CString::endsWith($optionValue, "t")) {
         return CUUnit::TERABYTE;
     }
     return CUUnit::BYTE;
 }
开发者ID:nunodotferreira,项目名称:Phred,代码行数:17,代码来源:CSystem.php

示例2: add

 /**
  * Adds a path component to a path, separating them with a slash if needed, and returns the combined path.
  *
  * If the specified path component already starts with "/", it still results in a single "/" as the separator. And,
  * as a special case, if the base path is empty, the returned string is the same as the specified path component.
  *
  * @param  string $basePath The base path (can be absolute or relative).
  * @param  string $component The path component to be added to the base path (cannot be absolute).
  *
  * @return CUStringObject The combined path.
  */
 public static function add($basePath, $component)
 {
     assert('is_cstring($basePath) && is_cstring($component)', vs(isset($this), get_defined_vars()));
     assert('!CString::isEmpty($component)', vs(isset($this), get_defined_vars()));
     if (CString::isEmpty($basePath)) {
         return $component;
     }
     if (!CString::endsWith($basePath, "/")) {
         $basePath .= "/";
     }
     return $basePath . $component;
 }
开发者ID:nunodotferreira,项目名称:Phred,代码行数:23,代码来源:CFilePath.php

示例3: speak

 /**
  * Echoes a message into the output and, if logging is enabled, into the log file, adding a space after the
  * message's text unless the message is already ending in a space.
  *
  * @param  string $message The message to be echoed.
  * @param  bool $writeToLog **OPTIONAL. Default is** `true`. If logging is enabled, tells whether the message
  * should also be written to the log file.
  *
  * @return void
  */
 public static function speak($message, $writeToLog = true)
 {
     assert('is_cstring($message) && is_bool($writeToLog)', vs(isset($this), get_defined_vars()));
     if (!CString::endsWith($message, " ")) {
         $message .= " ";
     }
     echo $message;
     if ($writeToLog && isset(self::$ms_logFp)) {
         self::writeToLog($message);
     }
 }
开发者ID:nunodotferreira,项目名称:Phred,代码行数:21,代码来源:CShell.php


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