當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。