本文整理汇总了PHP中String::substring方法的典型用法代码示例。如果您正苦于以下问题:PHP String::substring方法的具体用法?PHP String::substring怎么用?PHP String::substring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::substring方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getParent
public function getParent()
{
$result = new String($this->m_sFilename);
if ($result->lastIndexOf(new java_lang_String("/")) > -1) {
return $result->substring(0, $result->lastIndexOf(new String("/")));
} else {
return Translator_JavaBase::$null;
}
}
示例2: setPath
public function setPath($path_)
{
$this->m_pathParams = [];
if (0 == String::indexOf($path_, ':')) {
$pathParams = explode(':', String::substring($path_, 1));
} else {
$pathParams = explode(':', $path_);
}
foreach ($pathParams as $pathParam) {
$this->pushPathParam(\str\decodeUrl($pathParam));
}
return $this;
}
示例3: __construct
/**
* Initializes a new File Object from parent and child or just parent.
*/
public function __construct($parent = "", $child = "") {
$parent = new String($parent);
$child = new String($child);
if($parent->isEmpty())
throw new Exception("File path cannot be empty.");
if($parent->isEmpty() && $child->isEmpty())
throw new Exception("File path cannot be empty.");
if($parent->substring(-1) == $this::seperatorChar && !$child->isEmpty())
$this->path = $parent . $child;
else if(!$child->isEmpty())
$this->path = $parent . $this::seperatorChar . $child;
else
$this->path = $parent;
}
示例4: strtoupper
$currency_symbol = strtoupper($currency1);
$currency_info = $CFG->currencies[$currency_symbol];
API::add('Stats', 'getCurrent', array($currency_info['id']));
API::add('Transactions', 'get', array(false, false, 5, $currency1));
API::add('Orders', 'get', array(false, false, 5, $currency1, false, false, 1));
API::add('Orders', 'get', array(false, false, 5, $currency1, false, false, false, false, 1));
API::add('Currencies', 'getRecord', array('BTC'));
$query = API::send();
$stats = $query['Stats']['getCurrent']['results'][0];
$transactions = $query['Transactions']['get']['results'][0];
$bids = $query['Orders']['get']['results'][0];
$asks = $query['Orders']['get']['results'][1];
$btc_info = $query['Currencies']['getRecord']['results'][0];
$currencies = $CFG->currencies;
$page_title = strip_tags(str_replace('[currency]', $currency_symbol, Lang::string('home-landing-currency')));
$meta_desc = String::substring(strip_tags(str_replace('[currency]', '<strong>' . $currency_symbol . '</strong>', Lang::string('home-landing-currency-explain'))), 300);
include 'includes/head.php';
if ($stats['daily_change'] > 0) {
$arrow = '<i id="up_or_down" class="fa fa-caret-up" style="color:#60FF51;"></i> ';
} elseif ($stats['daily_change'] < 0) {
$arrow = '<i id="up_or_down" class="fa fa-caret-down" style="color:#FF5151;"></i> ';
} else {
$arrow = '<i id="up_or_down" class="fa fa-minus"></i> ';
}
?>
<div class="fresh_projects global_stats">
<div class="clearfix mar_top6"></div>
<div class="container">
<h1 style="margin-bottom:5px;"><?php
echo str_replace('BTC', $btc_info['name_' . $CFG->language], str_replace('[currency]', '<strong>' . $currency_info['name_' . $CFG->language] . '</strong>', Lang::string('home-landing-currency')));
?>
示例5: aggregate
function aggregate($name, $formula, $header_caption = false, $cumulative_function = false, $run_in_sql = false, $filter = false, $join_path = false, $join_condition = false)
{
global $CFG;
$this->fields[$name] = array('name' => $name, 'formula' => $formula, 'header_caption' => $header_caption ? $header_caption : String::substring($formula, 15), 'method_id' => $CFG->method_id, 'cumulative_function' => $cumulative_function, 'run_in_sql' => $run_in_sql, 'filter' => $filter, 'join_path' => $join_path, 'join_condition' => $join_condition, 'is_op' => 1);
}
示例6: substring
public function substring()
{
$str = new String('H�llo');
$this->assertEquals(new String('�llo'), $str->substring(1));
$this->assertEquals(new String('ll'), $str->substring(2, -1));
$this->assertEquals(new String('o'), $str->substring(-1, 1));
}
示例7: testSubString
public function testSubString()
{
$string = new String("Hello World");
$str = $string->substring(6);
$this->assertTrue($str->equals("World"));
$this->assertTrue($string->equals("Hello World"));
$str = $string->substring(6, 3);
$this->assertTrue($str->equals("Wor"));
$str = $string->substring(1, -1);
$this->assertTrue($str->equals("ello Worl"));
$string = new String("あいうえおかきくけこ");
$str = $string->substring(5);
$this->assertTrue($str->equals("かきくけこ"));
$str = $string->substring(6, 3);
$this->assertTrue($str->equals("きくけ"));
$str = $string->substring(1, -1);
$this->assertTrue($str->equals("いうえおかきくけ"));
}