當前位置: 首頁>>代碼示例>>PHP>>正文


PHP String::create方法代碼示例

本文整理匯總了PHP中String::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP String::create方法的具體用法?PHP String::create怎麽用?PHP String::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在String的用法示例。


在下文中一共展示了String::create方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testFromArrayToArrayList

 function testFromArrayToArrayList()
 {
     $input = array("one", "two");
     $output = String::fromPrimitives($input);
     $this->assertEqual(String::create("one"), $output->get(0));
     $this->assertEqual(String::create("two"), $output->get(1));
 }
開發者ID:aeberh,項目名稱:php-movico,代碼行數:7,代碼來源:StringFromPrimitivesTest.php

示例2: testOkIndex

 function testOkIndex()
 {
     $bla = String::create("Bla");
     $this->assertEqual(String::create("B"), $bla->charAt(0));
     $this->assertEqual(String::create("l"), $bla->charAt(1));
     $this->assertEqual(String::create("a"), $bla->charAt(2));
 }
開發者ID:aeberh,項目名稱:php-movico,代碼行數:7,代碼來源:StringCharAtTest.php

示例3: __construct

 public function __construct($url)
 {
     $this->url = $url;
     $viewParts = String::create($url)->split(self::URL_DELIMITER, 2);
     $this->view = $viewParts->get(0)->getPrimitive();
     $this->params = $viewParts->size() > 1 ? String::toPrimitives($viewParts->get(1)->split("/")) : array();
 }
開發者ID:aeberh,項目名稱:php-movico,代碼行數:7,代碼來源:ViewForward.php

示例4: getHref

 protected function getHref()
 {
     if (!String::create($this->action)->trim()->startsWith("\$") && $this->isLinkEnabled()) {
         return "#" . $this->action;
     }
     return "#";
 }
開發者ID:aeberh,項目名稱:php-movico,代碼行數:7,代碼來源:AbstractCommand.php

示例5: create

 public static function create($lang)
 {
     $content = String::create(file_get_contents("bean/games/boggle/data/blocks/{$lang}"));
     $layout = new ArrayList("String");
     foreach ($content->split("\n") as $die) {
         $layout->add($die->split(" ")->getRandomElement());
     }
     $layout->shuffle();
     return new BoggleGrid($layout);
 }
開發者ID:aeberh,項目名稱:php-movico,代碼行數:10,代碼來源:BoggleGrid.php

示例6: getChildrenWithTag

 private function getChildrenWithTag($tagName)
 {
     $tagNameStr = String::create($tagName);
     $result = new ArrayList("XmlElement");
     foreach ($this->children as $child) {
         if ($child->getName()->equals($tagNameStr)) {
             $result->add($child);
         }
     }
     return $result;
 }
開發者ID:aeberh,項目名稱:php-movico,代碼行數:11,代碼來源:XmlElement.php

示例7: __construct

 public function __construct($get, $post, $files)
 {
     $this->get = HashMap::fromArray("string", "?", $get);
     $this->post = HashMap::fromArray("string", "?", $post);
     $this->files = $files;
     $this->postVars = new ArrayList("MovicoPostVar");
     foreach ($post as $name => $value) {
         if (String::create($name)->startsWith("#")) {
             $type = isset($post[self::TYPE_PREFIX . $name]) ? $post[self::TYPE_PREFIX . $name] : self::DEFAULT_TYPE;
             $this->postVars->add(new MovicoPostVar($name, $value, $type));
         }
     }
 }
開發者ID:aeberh,項目名稱:php-movico,代碼行數:13,代碼來源:MovicoRequest.php

示例8: getXmlElement

 private function getXmlElement(SimpleXMLElement $el)
 {
     $result = new XmlElement(String::create($el->getName()));
     $result->setText(String::create($el));
     foreach ($el->children() as $child) {
         $xmlChild = $this->getXmlElement($child);
         $xmlChild->setParent($result);
         $result->addChild($xmlChild);
     }
     foreach ($el->attributes() as $name => $val) {
         $result->addAttribute($name, (string) $val);
     }
     return $result;
 }
開發者ID:aeberh,項目名稱:php-movico,代碼行數:14,代碼來源:SimpleXmlFactory.php

示例9: getXmlElement

 private function getXmlElement(DOMElement $el)
 {
     $result = new XmlElement(String::create($el->tagName));
     for ($i = 0; $i < $el->childNodes->length; $i++) {
         $child = $el->childNodes->item($i);
         if ($child instanceof DOMText) {
             $result->setText(String::create($child->textContent));
         } elseif ($child instanceof DOMElement) {
             $xmlChild = $this->getXmlElement($child);
             $xmlChild->setParent($result);
             $result->addChild($xmlChild);
         }
     }
     for ($i = 0; $i < $el->attributes->length; $i++) {
         $attr = $el->attributes->item($i);
         $result->addAttribute($attr->nodeName, $attr->nodeValue);
     }
     return $result;
 }
開發者ID:aeberh,項目名稱:php-movico,代碼行數:19,代碼來源:DOMXmlFactory.php

示例10: verifyXmlContents

 private function verifyXmlContents(XmlFactory $xmlFactory)
 {
     $xmlString = "<root><element1 attribute1=\"value1\" attribute2=\"value2\"/><element2><child>bla</child></element2></root>";
     $file = $xmlFactory->fromString(String::create($xmlString));
     $this->assertEqual("root", $file->getRootElement()->getName());
     $root = $file->getRootElement();
     $this->assertEqual(2, $root->getNbChildren());
     $this->assertEqual(1, $root->getNbChildren("element1"));
     $children = $root->getChildren();
     $el1 = $children->getFirst();
     $this->assertEqual("element1", $el1->getName());
     $this->assertEqual(2, $el1->getNbAttributes());
     $this->assertEqual("value1", $el1->getAttribute("attribute1"));
     $this->assertEqual("value2", $el1->getAttribute("attribute2"));
     $el2 = $children->getLast();
     $this->assertEqual("element2", $el2->getName());
     $child = $el2->getChildren()->getFirst();
     $this->assertEqual("bla", $child->getText());
     $this->assertEqual("element2", $child->getParent()->getName());
     $this->assertEqual($xmlString, $root->asXml());
     $this->assertEqual(1, $root->getNbDescendants("child"));
 }
開發者ID:aeberh,項目名稱:php-movico,代碼行數:22,代碼來源:XmlTest.php

示例11: match

 /**
  * Matches a string against this regex
  * @param string $input string to matcht he regex against
  * @return array|boolean Array of matching results. False if does not match
  */
 public function match($input)
 {
     String::create($input);
     return preg_match($this->value, $input->value, $matches) ? $matches : false;
 }
開發者ID:sntools,項目名稱:types,代碼行數:10,代碼來源:Regex.php

示例12: getCurrentColumnClass

 protected function getCurrentColumnClass($i)
 {
     $this->classList = String::create($this->columnClasses)->split(",");
     return $this->classList->get($i % $this->classList->size())->getPrimitive();
 }
開發者ID:aeberh,項目名稱:php-movico,代碼行數:5,代碼來源:DataSeries.php

示例13: __construct

 public function __construct($expression)
 {
     $this->expression = String::create($expression);
 }
開發者ID:aeberh,項目名稱:php-movico,代碼行數:4,代碼來源:BindingExpression.php

示例14: str

 private static function str($description = null, $source = null)
 {
     return String::create('validation/error:notEmpty', 'Should be not empty', $description, $source);
 }
開發者ID:magomogo,項目名稱:translator-utils,代碼行數:4,代碼來源:StringTest.php

示例15: shouldBeRendered

 public function shouldBeRendered($index)
 {
     $renderedStr = String::create($this->rendered);
     if ($renderedStr->contains("!")) {
         return !$this->getConvertedValue($renderedStr->replace("!", "")->__toString(), $index);
     } else {
         return $this->getConvertedValue($this->rendered, $index);
     }
 }
開發者ID:aeberh,項目名稱:php-movico,代碼行數:9,代碼來源:Component.php


注:本文中的String::create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。