@param string $text

@return float
429240
public function readLongitude(string $text): float
    {
        return $this->readDegrees($text, self::LONGITUDE_EAST, self::LONGITUDE_WEST);
    }
174724
public function setText(string $text)
    {
        $this->resource = mailparse_msg_create();
        $eaten = 0;
        $text_length = strlen($text);
        while ($eaten < $text_length) {
            mailparse_msg_parse($this->resource, substr($text, $eaten, 2082));
            $eaten += 2082;
        }

        $this->text = $text;

        return $this;
    }
990952
public static function import($text)
    {
        $inspector = \Core::make('import/value_inspector');
        $result = $inspector->inspect((string) $text);

        return $result->getReplacedContent();
    }
607262
public static function confirm($text)
    {
        top:
        $input = strtolower(static::input("$text [y/n]: "));
        if (!in_array($input, array('y', 'n'))) goto top;
        return $input === 'y' ? true : false;
    }
1272664
public function parse(string $text) : string
    {
        if ($text === '')
            throw new ParseException($this, $text, 0, self::NO_EMPTY);
        return $text;
    }
163161
public static function date($text)
	{
	    if(!preg_match("/^([\\d]+)[\\-\\/]([\\d]{1,2})[\\-\\/]([\\d]{1,2})$/", $text, $match)) {
	        return false;
	    }

	    list($_, $year, $month, $day) = $match;

	    // 001
	    if (strlen($month) > 2 || strlen($day) > 2) {
	        return false;
	    }

	    if (!checkdate($month, $day, $year)) {
	        return false;
	    }

	    return true;
	}
1035596
private function getRatio(string $value) : float
    {
        if (strpos($value, '%') !== false) {
            $result = ((float)str_replace('%', '', $value)) / 100;
        } else {
            $result = $value;
        }

        return (float)$result;
    }
953767
public static function toBytes(String $data) : Float
    {
        $number = substr($data, 0, -2);

        switch( strtoupper(substr($data, -2)) )
        {
            case 'KB': return $number * 1024;
            case 'MB': return $number * pow(1024, 2);
            case 'GB': return $number * pow(1024, 3);
            case 'TB': return $number * pow(1024, 4);
            case 'PB': return $number * pow(1024, 5);

            default  : return $data;
        }
    }
874493
def ParseFloat(text):
  
  try:
    # Assume Python compatible syntax.
    return float(text)
  except ValueError:
    # Check alternative spellings.
    if _FLOAT_INFINITY.match(text):
      if text[0] == '-':
        return float('-inf')
      else:
        return float('inf')
    elif _FLOAT_NAN.match(text):
      return float('nan')
    else:
      # assume '1.0f' format
      try:
        return float(text.rstrip('f'))
      except ValueError:
        raise ValueError('Couldn\'t parse float: %s' % text)
1094824
public static function ctype_alnum($text)
    {
        $text = self::convert_int_to_char_for_ctype($text);

        return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
    }
818643
public static function numberOfWords($text) {
		$count = 0;
		$words = explode(' ', $text);
		foreach ($words as $word) {
			$word = trim($word);
			if (!empty($word)) {
				$count++;
			}
		}
		return $count;
	}
690104
public static function ctype_digit($text)
    {
        $text = self::convert_int_to_char_for_ctype($text);

        return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
    }
154169
public static function normalizeText($text)
    {
        $text = strtolower($text);
        $text = preg_replace('/[^a-z0-9 -]/im', ' ', $text);
        $text = preg_replace('/( +)/im', ' ', $text);

        return trim($text);
    }
105078
public function normalizeText( $text )
    {
        if ( $this->searchHandler instanceof LegacyHandler )
        {
            $searchEngine = new eZSearchEngine();
            return $searchEngine->normalizeText( $text );
        }

        return $text;
    }
192316
public static function Parse( $text )
	{
		$text = CoreFuncs::NormalizeSpace( $text );

		// $x = "-2016-01-02T09:08:02.1234Z";
		// $x = "-2016-01-02";
		// $x = "-2016-01-02T09:08:02";
		// $x = "-2016-01-02T09:08";
		// $x = "-2016-01-02T09";
		$pattern = "^((?<time>(?<hour>[0-9]{1,2})(:(?<minute>[0-9]{1,2}))?(:(?<second>[0-9]{2,2}))?)(\.(?<micro>[0-9]+))?)?(?<offset>(?=[+\-a-zA-Z]).*)?$";

		$result = preg_match( "/$pattern/", $text, $matches );
		$error = empty( $text ) || ! $result ||
				( ! empty( $matches['offset'] ) && $matches['offset'] == $text ) ||
				( empty( $matches['minute'] ) && empty( $matches['second'] ) ) ||
				( ! empty( $matches['hour'] )   && ( $matches['hour'] > 24 ) ) ||
				( ! empty( $matches['minute'] ) && ( $matches['minute'] > 59 ) ) ||
				( ! empty( $matches['second'] ) && ( $matches['second'] > 59 ) ) ||
				( ! empty( $matches['offset'] ) && ! preg_match( "/^[+-]?\d+$|^[+-]?\d{2}:\d{2}$|^[a-z]+$/i", $matches['offset'] ) );

		if ( ! $error )
		{
			$timeSeconds = ( empty( $matches['hour'] ) ? 0 : $matches['hour'] * 3600 ) +
			( empty( $matches['minute'] ) ? 0 : $matches['minute'] * 60 ) +
			( empty( $matches['second'] ) ? 0 : $matches['second'] * 1 ) +
			( empty( $matches['micro'] ) ? 0 : $matches['micro'] / 1000 );
			$error = $timeSeconds > 86400;

			if ( ! $error && ! empty( $matches['offset'] ) && preg_match( "/^[+-](?<hours>\d{2})(:(?<minutes>\d{2}))?$/", $matches['offset'], $offsetMatches ) )
			{
				$error = ( ! empty( $offsetMatches['hours'] ) && $offsetMatches['hours'] > 14 ) ||
				empty( $offsetMatches['minutes'] ) ||
				$offsetMatches['minutes'] > 59;
			}
		}

		if ( $error )
		{
			throw XPath2Exception::withErrorCodeAndParams( "FORG0001", Resources::FORG0001, array( $text, "Date" ) );
		}

		$sign = empty( $matches['sign'] ) ? false : $matches['sign'] == "-" ;
		$date = empty( $matches['date'] ) ? "1970-01-01" : $matches['date'];
		$time = empty( $matches['time'] ) ? "" : $matches['time'];
		$offset = empty( $matches['offset'] ) ? "" : $matches['offset'];

		$microseconds = empty( $matches['micro'] ) ? 0 : $matches['micro'];
		$notlocal = ! empty( $matches['offset'] );

		$T = $date && $time ? "T" : "";

		/**
		 * @var DateTime $dateTime
		 */
		$dateTime = new \DateTime( "{$date}$T{$time}$offset" );
		$dateTime->microseconds = $microseconds;

		return new TimeValue( $dateTime, $notlocal );
	}
931778
private static function toFloat($x)
    {
        if (is_float($x)) return $x;
        if (is_int($x)) return $x;
        if (is_string($x)) {
            $r = Rational::parse($x);
            return $r->p/$r->q;
        }
        throw new SyntaxErrorException();
    }
379080
public static function parse($text)
	{
		if (isset(static::$beforeParse))
		{
			$text = call_user_func(static::$beforeParse, $text);
		}

		$xml = static::getCachedParser()->parse($text);

		if (isset(static::$afterParse))
		{
			$xml = call_user_func(static::$afterParse, $xml);
		}

		return $xml;
	}