@param string

@return string
354227
public function normalizeUrl($url)
    {
        $url = trim($url, '/') .'/';

        // if the page is the index page then hide it from the menu
        if (strpos(strtolower($url), '/index.md/')) {
            $url = substr($url, 0, strpos($url, "index.md/"));
        }

        return $url;
    }
360897
public static function variablize($string)
    {
        $string = self::camelize(self::underscore($string));
        $result = strtolower(substr($string, 0, 1));
        $variable = preg_replace('/\\w/', $result, $string, 1);
        return $variable;
    }
499451
public function parse( $string ) {
        $data = parse_url( $string );
        
        //helper function gets $a[$k], checks if exists
        function get( $a, $k ) {
            if( array_key_exists( $k, $a ) ) {
                return empty( $a[$k] ) ? null : $a[$k];
            }
            
            return null;
        }
        
        if( $data === null ) {
            return null;
        }
        
        $uri = new Uri;
        
        $uri->setProtocol( get( $data, 'scheme' ) );
        $uri->setUsername( get( $data, 'user' ) );
        $uri->setPassword( get( $data, 'pass' ) );
        $uri->setHost( get( $data, 'host' ) );
        $uri->setPort( get( $data, 'port' ) );
        $uri->setPath( get( $data, 'path' ) );
        $uri->setQuery( get( $data, 'query' ) );
        $uri->setAnchor( get( $data, 'anchor' ) );
        
        return $uri;
    }
45105
public static function encode($string)
    {
        return is_null($string) ? self::NULL : strtr($string, self::$encodeMap);
    }
820933
public static function strlen( $string )
    {
        if ( false === ( $_encoding = static::mbSupported( $string ) ) )
        {
            return strlen( $string );
        }

        return mb_strwidth( $string, $_encoding );
    }
1241117
function _getName($string)
	{
		if (preg_match('/name=("([^"]*)"|\'([^\']*)\'|[^>\s]*)([^>]*)?>/is', $string, $match)) {
			//preg_match('/name=["\']?([\w\s]*)["\']?[\s>]/i', $string, $match)) { -- did not work as expected
			$val_match = trim($match[1]);
			$val_match = trim($val_match, '"\'');
			unset($string);
			return trim($val_match, '"');
		}
		return false;
	}
1337568
public function string($string = NULL)
	{
		if (func_num_args() === 0)
		{
			return $this->_string;
		}
		$this->_string = $string;
		return $this;
	}
67019
public static function decode($string)
    {
        return ($string === self::NULL) ? null : strtr($string, self::$decodeMap);
    }
745498
public function translate($string)
    {
        $args = func_get_args();
        $unstranslatedString = array_shift($args);
        $extraParams = $args;
        $translated = $this->getAdaptor()->translate($unstranslatedString);
        if (count($extraParams)>0)
        {
            $translated = vsprintf($translated, $extraParams);
        }

        return $translated;
    }
908282
public static function str2bin($string)
    {
        if (is_array($string) || is_object($string)) {
            $caller =  next(debug_backtrace());
            $error['line']  = $caller['line'];
            $error['file']  = strip_tags($caller['file']);
            trigger_error(
                "str2bin() expects parameter 1 to be string, "
                . gettype($string)
                . " given in <b>{$error['file']}</b> on line <b>{$error['line']}</b><br />\n",
                E_USER_ERROR
            );

            return '';
        }

        if (strlen($string) <= 0) {
            return '';
        }

        $string = str_split($string, 1);
        for ($i = 0, $n = count($string); $i < $n; ++$i) {
            $string[$i] = decbin(ord($string[$i]));
            $string[$i] = str_repeat("0", 8 - strlen($string[$i])) . $string[$i];
        }

        return implode("", $string);
    }
414678
public function prepare(string $string): string
    {
        foreach ($this->_steps as $step) {
            $string = $step->apply($string);
        }
        return $string;
    }
510811
function gettext($string)
    {
        global $PPHP;
        $req = grab('request');

        $default = $PPHP['config']['global']['default_lang'];
        $current = $req['lang'];

        $res = $string;
        try {
            if (self::$_gettext !== null) {
                $res = self::$_gettext->gettext($string);
            };
        } catch (\Exception $e) {
            echo $e->getMessage();
        };
        return $res;
    }
737283
public static function getValue(string $string)
    {
        if ($string === "TRUE" || $string === "true" || $string === "false" || $string === "FALSE")
            return $string === "TRUE" || $string === "true";
        elseif (is_numeric($string) && preg_match('/\./i', $string))
            return (float)$string;
        elseif (is_numeric($string))
            return (int)$string;
        elseif (Validate::json($string))
            return self::getValueList(json_decode($string, true));
        elseif (is_array($string))
            return self::getValueList($string);

        return (string)$string;
    }
290083
public function format($string) {
		
		$string = ucwords(str_replace('&', 'and', strtolower($string)));
		
		if( $this->isRemovingSpaces() ) {
			$string	= str_replace(' ', '', $string);
		}
		
		$string	= strtr($string, ' .\'"', '----');
		if( $this->caseProcessing ) {
			if( $this->isCamelCaseProcessing() ) {
				if( $this->caseProcessing == self::LOWERCAMELCASE ) {
					$string = lcfirst($string);
					// } else
					// if( $case == UPPERCAMELCASE ) {
					// $string = ucfirst($string);
				}
			}
		}
		return convertSpecialChars($string);
	}
483704
public function format($string) {
        if ($this->isAnsiEnabled()) {
            return $this->formatAnsi($string);
        }

        return $this->formatPlain($string);
    }
8348
public function getString($string)
    {
        // Exact match?
        if (isset($this->strings[$string])) {
            return $this->strings[$string];
        } else {
            return $string;
        }
    }
1075240
public function apply(string $string) : string
    {
        return str_replace($this->search, $this->replace, $string);
    }