Returns the number of words in $value.

@param string $value

@return int
481981
private static function numWords($value)
    {
        $value = preg_replace('/<.[^<>]*?>/', ' ', $value);
        $value = preg_replace('/&nbsp;|&#160;/i', ' ', $value);
        $value = preg_replace('/[.(),;:!?%#$\'\"_+=\/\-“”’]*/', '', $value);
        preg_match_all('/\b\w+\b/', $value, $words);

        return count($words[0]);
    }
562443
private function getValue($value)
    {
        if ($this->isBoolean($value)) {
            return (strtolower($value) === 'true');
        } elseif ($this->isInteger($value)) {
            return (int)$value;
        } elseif ($this->isNumber($value)) {
            return (float)$value;
        }
        return $value;
    }
924660
public function wordCount()
    {
        $count = 0;

        foreach ($this->getParameters() as $value)
            $count += str_word_count(strip_tags($value));

        return $count;
    }
701471
public static function countDecimals(float $value)
    {
        // When the value when cast to an integer is about the same, return 0 decimal places. Otherwise count them.
        return (int) $value == $value ? 0 : (strlen($value) - strrpos($value, '.') - 1);
    }
343296
protected function parseNumeric($value)
    {
        if (is_numeric($value)) {
            if (false !== strrpos($value, '.')) {
                return (float) $value;
            }

            return (int) $value;
        }

        return $value;
    }
1145294
public function filter($value)
    {
        if (!is_string($value)) {
            return $value;
        }

        $value = (string) $value;

        // Split the string into separate words
        /** @var array $words */
        $words   = explode(' ', (string) $value);
        $results = [];

        foreach ($words as $key => $word) {
            // If this is the first, or it's not a small word, capitalize it
            if ($key === 0 || !in_array($word, static::$_excludeWords, true)) {
                if ($this->options['encoding'] !== null) {
                    $word = mb_convert_case($word, MB_CASE_TITLE, $this->options['encoding']);
                } else {
                    $word = ucwords(strtolower($word));
                }
            }

            $word = trim($word);

            if (strlen($word) > 0) {
                $results[] = $word;
            }
        }

        return implode(' ', $results);
    }
1338530
public static function getName($value)
    {
        $enumerables = self::getCache();
        $result = array_search($value, $enumerables, true);
        
        if ($result === false) {
            throw EnumerableException::valueNotFound();
        }
        
        return $result;
    }
111561
protected function getExtraLengthBits($value)
    {
        if (($value >= 257 && $value <= 260) || $value === 285) {
            return 0;
        } elseif ($value >= 261 && $value <= 284) {
            return (($value - 257) >> 2) - 1;
        } else {
            throw new Exception\InvalidArgumentException('value', 'Invalid value');
        }
    }
1071940
public function setWord(string $value) : SearchIndex
    {

        if ($this->data['word'] !== $value) {
            $this->data['word'] = $value;
            $this->setModified('word');
        }

        return $this;
    }
1138381
public function append(string $value): int
    {
        return intval($this->handle->append($this->name, $value));
    }
517918
public static function plainNumber(string $value) : int {
		$temp = explode('ext', $value);
		$result = preg_replace('/[^0-9]/', '', $temp[0]);
		// remove first 1 in US numbers
		if (strlen($result) == 11 && $result[0] == 1) {
			$result = substr($result, 1);
		}
		return $result;
	}
122362
public static function int($value): int
    {
        $cleaned = preg_replace('#[^0-9-+.,]#', '', $value);
        preg_match('#[-+]?[\d]+#', $cleaned, $matches);
        $result = $matches[0] ?? 0;

        return (int)$result;
    }
202090
public function checkChars($value)
    {
        if (strlen($value) != 8) {
            if (strpos($value, 'X') !== false) {
                return false;
            }
        }

        return parent::checkChars($value);
    }
922082
public function process($value, $numwords = false)
    {
        if ($numwords || preg_match('#^[^0-9]+$#', $value)) {
            return mb_convert_case((string)$value, MB_CASE_TITLE, $this->core->getCharset());
        } else {
            $bits = explode(' ', (string)$value);
            $out  = '';
            foreach ($bits as $k => $v){
                if (preg_match('#^[^0-9]+$#', $v)) {
                    $out .= ' ' . mb_convert_case($v, MB_CASE_TITLE, $this->core->getCharset());
                } else {
                    $out .= ' ' . $v;
                }
            }

            return substr($out, 1);
        }
    }
690518
function getValueCount( $val )
    {
        $val_cnt = false;

        if ( $val === null )
        {
            $val_cnt = 0;
        }
        else if ( $val === true || $val === false )
        {
            $val_cnt = (int)$val;
        }
        else if ( is_array( $val ) )
        {
            $val_cnt = count( $val );
        }
        else if ( is_object( $val ) and
                  method_exists( $val, "attributes" ) )
        {
            $val_cnt = count( $val->attributes() );
        }
        else if ( is_numeric( $val ) )
        {
            $val_cnt = $val;
        }
        else if ( is_string( $val ) )
        {
            $val_cnt = strlen( $val );
        }
        return $val_cnt;
    }
920505
protected function _value($value)
    {
        if ($value === null) {
            return 'null';
        }
        if ($value === true) {
            return 'true';
        }
        if ($value === false) {
            return 'false';
        }

        return (string)$value;
    }
317942
public function getAndSet(int $value): int
    {
        return intval($this->handle->getSet($this->name, strval($value)));
    }