/// A simple URL shortening function that reduces the
/// URL length if it exceeds a given threshold
A simple URL shortening function that reduces the
URL length if it exceeds a given threshold
A simple URL shortening function that reduces the URL length if it exceeds a given threshold
pub fn shorten_url(url: &str) -> String {
    let len = url.chars().count();
    if len > MAX_URL_LEN {
        url.substring(0, 50).to_string() + "..." + url.substring(len - 14, len)
    } else {
        url.to_string()
    }
}
pub fn shorten_url ( url : & str ) -> String { let len = url . chars ( ) . count ( ) ; if len > MAX_URL_LEN { url . substring ( 0 , 50 ) . to_string ( ) + " " + url . substring ( len - 14 , len ) } else { url . to_string ( ) } }
A simple URL shortening function that reduces the
URL length if it exceeds a given threshold
A simple URL shortening function that reduces the URL length if it exceeds a given threshold
url
&str