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


PHP String::contains方法代码示例

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


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

示例1: testContains

 public function testContains()
 {
     $string = new String("Test5");
     $this->assertTrue($string->contains("e"));
     $this->assertFalse($string->contains("X"));
     $this->assertTrue($string->contains("E", true));
     $this->assertFalse($string->contains("E", false));
 }
开发者ID:seanyainkiranina,项目名称:completecontrol,代码行数:8,代码来源:stringtest.class.php

示例2: close

 /**
  * Performs te closure of the session of a project.<br>
  * @param string $project The name of the current project
  */
 public static function close($project)
 {
     $this->activate();
     reset($_SESSION);
     while (list($key, $val) = each($_SESSION)) {
         if (String::contains($key, $project)) {
             $this->deleteValue($key);
         }
     }
     reset($_SESSION);
 }
开发者ID:stefanFramework,项目名称:rachel-roxxx,代码行数:15,代码来源:Session.php

示例3: assertNotContains

/**
 * @param mixed $value_
 * @param string $pattern_
 *
 * @return boolean|false If given array/string does contain given pattern.
 */
function assertNotContains($value_, $pattern_)
{
    $message = Assertion_Helper::getMessage('Expected any type not containing a key/value matching given pattern', __FUNCTION__, func_get_args());
    if (is_array($value_)) {
        if (false !== Arrays::containsKeyBySubstring($value_, $pattern_, Arrays::RECURSIVE) || false !== Arrays::containsValueBySubstring($value_, $pattern_, Arrays::RECURSIVE)) {
            Assertion_Context::current()->add(__FUNCTION__, false, $message);
            return false;
        }
    } else {
        if (String::contains($value_, $pattern_)) {
            Assertion_Context::current()->add(__FUNCTION__, false, $message);
            return false;
        }
    }
    Assertion_Context::current()->add(__FUNCTION__, true, $message);
    return true;
}
开发者ID:evalcodenet,项目名称:net.evalcode.components.test,代码行数:23,代码来源:assertion.php

示例4: containsValueBySubstring

 public static function containsValueBySubstring(array $array_, $substring_, $mode_ = 3, array &$parentKeys_ = [])
 {
     $exists = false;
     $nestedArrays = [];
     $recursive = Bitmask::hasBitForBitmask($mode_, self::RECURSIVE);
     // search current level
     foreach ($array_ as $key => $value) {
         if (is_array($value)) {
             $nestedArrays[] = $key;
         } else {
             if (false === $exists) {
                 $exists = String::contains($value, $substring_);
                 if (false !== $exists) {
                     $exists = $key;
                     if (false === $recursive) {
                         return $exists;
                     }
                 }
             }
         }
     }
     if (false === $recursive) {
         return $exists;
     }
     // proceed with nested levels if requested
     foreach ($nestedArrays as $nestedArray) {
         $exists = self::containsValueBySubstring($array_[$nestedArray], $substring_, $mode_, $parentKeys_);
         if (false !== $exists) {
             array_unshift($parentKeys_, $nestedArray);
             return $exists;
         }
     }
     return $exists;
 }
开发者ID:evalcodenet,项目名称:net.evalcode.components.type,代码行数:34,代码来源:arrays.php

示例5: contains

 public function contains()
 {
     $str = new String('H�llo');
     $this->assertTrue($str->contains('H'));
     $this->assertTrue($str->contains('�'));
     $this->assertTrue($str->contains('o'));
     $this->assertFalse($str->contains(''));
     $this->assertFalse($str->contains('4'));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:9,代码来源:StringTest.class.php

示例6: inString

 /**
  * A faster/less memory substitute for strstr() or preg_match
  * used to check the occurrence of a subject in a string.
  *
  * @param string $needle
  * @param array $haystack
  * @return bool
  **/
 public static function inString($needle, $haystack)
 {
     return String::contains($needle, $haystack);
 }
开发者ID:nesbert,项目名称:nobjects,代码行数:12,代码来源:Validate.php

示例7: String

include('lib/Common.java.php');
include('lib/System.java.php');
include('lib/String.java.php');
include('lib/File.java.php');

// Initialize a String
$hello = new String("World");

// Show it lowercase
out::prntln("Lowercase of '{$hello->toString()}': " . $hello->toLowerCase());

// Show the string's equality without case
out::prntln("EqualsIgnoreCase test against 'world': " . (($hello->equalsIgnoreCase("world")) ? 'true' : 'false'));

// Show the string's containment for "e"
out::prntln("Contains 'e'? " . (($hello->contains("e")) ? 'true' : 'false'));

// Show the last index of o
out::prntln("Last index of 'o': " . ((!$hello->lastIndexOf("o")) ? 'false' :  $hello->lastIndexOf("o")));

// ----------------------------------------------------- //

// New Section
out::prntln();

// ----------------------------------------------------- //

// Initialize a File
$file = new File("index.php");

// Get the name
开发者ID:nijikokun,项目名称:java.php,代码行数:31,代码来源:Examples.java.php

示例8: MySQLHandler

<?php 
include_once $_SERVER['DOCUMENT_ROOT'] . "/LIB/libMySQL.php";
include $_SERVER['DOCUMENT_ROOT'] . 'KhunluungramnerkP/loginMySQL.php';
$handler = new MySQLHandler('localhost', 'khunluungramnerk', $usrDB["user"], $usrDB["passwd"]);
$handler->conn();
$getPalabra = array("tipo" => "SELECT", "campos" => array("id, palabra_et, posición, raíz"), "tablas" => "etim_raiz");
$handler->query($getPalabra);
foreach ($handler->data->lista as $etimología) {
    var_dump($etimología);
    $id = $etimología["id"];
    $RaizCompuesta = new String($etimología["raíz"]);
    if ($RaizCompuesta->contains('-')) {
        $RaizCompuesta = explode('-', $RaizCompuesta->get());
        $RaizCompuesta[1] = '-' . $RaizCompuesta[1];
        $primer = new String($RaizCompuesta[0]);
        if ($primer->equals('')) {
            unset($RaizCompuesta[0]);
        }
    } elseif ($RaizCompuesta->contains('+')) {
        $RaizCompuesta = explode('+', $RaizCompuesta->get());
    }
    var_dump($RaizCompuesta);
    $elimRaizPrevia = array("tipo" => "DELETE", "tabla" => "etim_raiz", "condicion" => array("id" => $id));
    $handler->query($elimRaizPrevia);
    $i = 1;
    foreach ($RaizCompuesta as $raiz) {
        $insertRaiz = array("tipo" => "INSERT", "campos" => array("id" => $id, "posición" => $i, "raíz" => $raiz), "tabla" => "etim_raiz");
        $handler->query($insertRaiz);
        $i++;
    }
}
开发者ID:Javain,项目名称:Khunluungramnerk,代码行数:31,代码来源:fragmentarEtimologiasRaiz.php


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