src/classes/CCStr.php
public static function cut( $string, $key, $cut_key = true, $last = false ) 
	{
		if ( $last )
		{
			$pos = strrpos( $string, $key );
		}
		else 
		{
			$pos = strpos( $string, $key );
		}

		if ( $pos === false ) 
		{
			return $string;
		}
		if ( !$cut_key ) 
		{
			$pos += strlen( $key );
		}
		return substr( $string, 0, $pos );
	}
public static function cut( $string, $key, $cut_key = true, $last = false ) 
	{
		if ( $last )
		{
			$pos = strrpos( $string, $key );
		}
		else 
		{
			$pos = strpos( $string, $key );
		}

		if ( $pos === false ) 
		{
			return $string;
		}
		if ( !$cut_key ) 
		{
			$pos += strlen( $key );
		}
		return substr( $string, 0, $pos );
	}
public static function cut ( $ string , $ key , $ cut_key = true , $ last = false ) { if ( $ last ) { $ pos = strrpos ( $ string , $ key ) ; } else { $ pos = strpos ( $ string , $ key ) ; } if ( $ pos === false ) { return $ string ; } if ( ! $ cut_key ) { $ pos += strlen ( $ key ) ; } return substr ( $ string , 0 , $ pos ) ; }
Cuts a string after another string.

CCStr::cut( 'some/path/to/user.config.xml', '.' ); // some/path/to/user
CCStr::cut( 'some/path/to/user.config.xml', '/', false ); // some/
CCStr::cut( 'some/path/to/user.config.xml', '/', true, true ); // some/path/to

@param string 	$string
@param string		$key				The string that after that should be cutted.
@param bool		$cut_key			Should the key itself also be removed?
@param bool		$last			Cut after the last appearing of the key?
@return string
Cuts a string after another string .