sob/utilities/string.py
def url_relative_to(absolute_url: str, base_url: str) -> str:
    """
    Returns a relative URL given an absolute URL and a base URL
    """
    # If no portion of the absolute URL is shared with the base URL--the
    # absolute URL will be returned
    relative_url: str = absolute_url
    base_url = url_directory_and_file_name(base_url)[0]
    if base_url:
        relative_url = ""
        # URLs are not case-sensitive
        base_url = base_url.lower()
        lowercase_absolute_url = absolute_url.lower()
        while base_url and (
            base_url.lower() != lowercase_absolute_url[: len(base_url)]
        ):
            relative_url = "../" + relative_url
            base_url = url_directory_and_file_name(base_url[:-1])[0]
        base_url_length: int = len(base_url)
        relative_url += absolute_url[base_url_length:]
    return relative_url

    Returns a relative URL given an absolute URL and a base URL
    
Returns a relative URL given an absolute URL and a base URL
Returns a relative URL given an absolute URL and a base URL
def url_relative_to(absolute_url: str, base_url: str) -> str:
    relative_url: str = absolute_url
    base_url = url_directory_and_file_name(base_url)[0]
    if base_url:
        relative_url = ""
        base_url = base_url.lower()
        lowercase_absolute_url = absolute_url.lower()
        while base_url and (
            base_url.lower() != lowercase_absolute_url[: len(base_url)]
        ):
            relative_url = "../" + relative_url
            base_url = url_directory_and_file_name(base_url[:-1])[0]
        base_url_length: int = len(base_url)
        relative_url += absolute_url[base_url_length:]
    return relative_url
def url_relative_to ( absolute_url : str , base_url : str ) -> str : relative_url : str = absolute_url base_url = url_directory_and_file_name ( base_url ) [ 0 ] if base_url : relative_url = "" base_url = base_url . lower ( ) lowercase_absolute_url = absolute_url . lower ( ) while base_url and ( base_url . lower ( ) != lowercase_absolute_url [ : len ( base_url ) ] ) : relative_url = "../" + relative_url base_url = url_directory_and_file_name ( base_url [ : - 1 ] ) [ 0 ] base_url_length : int = len ( base_url ) relative_url += absolute_url [ base_url_length : ] return relative_url
Returns a relative URL given an absolute URL and a base URL
Returns a relative URL given an absolute URL and a base URL
"""
    Returns a relative URL given an absolute URL and a base URL
    """ # If no portion of the absolute URL is shared with the base URL--the # absolute URL will be returned # URLs are not case-sensitive
absolute_url
str
base_url
str