Counts the occurrences of the specified substring in this string

@param string $substring the substring whose occurrences to count
@return int the number of occurrences
979081
public function count($substring = null) {
		if ($substring === null) {
			return mb_strlen($this->rawString, $this->charset);
		}
		else {
			return mb_substr_count($this->rawString, $substring, $this->charset);
		}
	}
527705
public function ensureLeft($substring) {
        $stringy = self::create($this->str, $this->encoding);

        if (!$stringy->startsWith($substring))
            $stringy->str = $substring . $stringy->str;

        return $stringy;
    }
1178567
public function compareToIgnoreCase($string): int
    {
        Assert::typeOf(['string', __CLASS__], $string);

        return strcasecmp($this->data, (string) $string) <=> 0;
    }
965372
protected function substrCount($haystack, $needle, $offset, $length)
    {
        static $oldVersion;
        if ($oldVersion === null) {
            $oldVersion = version_compare(PHP_VERSION, '5.1', '<');
        }
        if ($oldVersion) {
            $haystack = substr($haystack, $offset, $length);
            return substr_count($haystack, $needle);
        } else {
            return substr_count($haystack, $needle, $offset, $length);
        }
    }
394347
public static function subCount($haystack, $needle)
    {
        if (self::isMBString()) {
            return mb_substr_count($haystack, $needle, self::$encoding);
        }

        return substr_count($haystack, $needle); // @codeCoverageIgnore
    }
1269693
private function compareBcStrings(string $a, string $b) : int
    {
        $a_len = strlen($a);
        $b_len = strlen($b);

        if ($a_len > $b_len) {
            return -1;
        }

        if ($a_len < $b_len) {
            return 1;
        }

        $a_len = strlen(str_replace(['*', '?'], '', $a));
        $b_len = strlen(str_replace(['*', '?'], '', $b));

        if ($a_len > $b_len) {
            return -1;
        }

        if ($a_len < $b_len) {
            return 1;
        }

        return 0;
    }
463830
public static function contains($string = false, $substring = false) {

        if ($substring && $substring && strpos($string, $substring) !== false) {

            return true;
        }

        return false;
    }
80373
def find(self, substring):
        '''
        
        '''
        if isinstance(substring, ByteData):
            substring = substring.to_bytes()
        return self._bytes.find(substring)
918078
public function startsWithIgnoreCase($substring) {
		$substring = mb_strtolower($substring, $this->encoding);
		$substringLength = mb_strlen($substring, $this->encoding);
		$startOfStr = mb_strtolower(mb_substr($this->string, 0, $substringLength, $this->encoding));

		return (string) $substring === $startOfStr;
	}
394434
public static function DotCount( $str ) {

	    $count = 0;

	    for ( $i = 0; $i < strlen( $str ); $i++) {

		if ( substr( $str, $i, 1 ) == '.' ) $count ++;

	    }

	    return $count;

	}
523339
public boolean contains(final BinaryString substring) {
		ensureMaterialized();
		substring.ensureMaterialized();
		if (substring.sizeInBytes == 0) {
			return true;
		}
		int find = SegmentsUtil.find(
			segments, offset, sizeInBytes,
			substring.segments, substring.offset, substring.sizeInBytes);
		return find != -1;
	}
686424
public function countNumberOfUserInSearch($searchString = null)
    {
        $builder = $this->buildUserSearchQuery($searchString);

        return $builder->select($builder->expr()->count('u.id'))
            ->getQuery()
            ->getSingleScalarResult();
    }
1065489
public static function len($string): int
    {
        if (self::isMBString()) {
            return mb_strlen($string, self::$encoding);
        }

        return strlen($string); // @codeCoverageIgnore
    }
1054896
public static function substring($string, $start = 0, $length = null)
    {
        if (!self::isValid($string)) {
            return false;
        }

        return mb_substr($string, $start, $length);
    }
919175
public static function stringToKey(string $string): int {
        $key = 0;
        for ($i = 0; $i < \strlen($string); $i++) {
            $char = $string[$i];
            $key += \ord($char);
        }
        return $key;
    }
554553
public function hasSubstring( $pSubstring ) {
        if ( strlen( $pSubstring ) < 1 ) {
            return -1;
        }

        return $this->findSubstring( $this->nodes[$this->root], $pSubstring );
    }
340636
public function count(string $needle) : int
    {
        return substr_count(strtolower($this->getText()), strtolower($needle));
    }