pub fn longest_common_prefix<'s>(strings: &'s [&str]) -> &'s str {
    if strings.is_empty() {
        return "";
    }
    let str0 = strings[0];
    let str0bytes = str0.as_bytes();
    let mut len = str0.len();
    for str in &strings[1..] {
        len = cmp::min(
            len,
            str.as_bytes()
                .iter()
                .zip(str0bytes)
                .take_while(|&(a, b)| a == b)
                .count(),
        );
    }
    &strings[0][..len]
}
/// Longest Common Prefix
///
/// Given a vector of string slices, calculate the string
/// slice that is the longest common prefix of the strings.
///
/// ```
/// use commands::util::longest_common_prefix;
///
/// let words = &["zebrawood", "zebrafish", "zebra mussel"];
/// let prefix = longest_common_prefix(words);
/// assert_eq!(prefix, "zebra");
/// ```
Longest Common Prefix
Given a vector of string slices, calculate the string
slice that is the longest common prefix of the strings.




Longest Common Prefix Given a vector of string slices calculate the string slice that is the longest common prefix of the strings .
pub fn longest_common_prefix<'s>(strings: &'s [&str]) -> &'s str {
    if strings.is_empty() {
        return "";
    }
    let str0 = strings[0];
    let str0bytes = str0.as_bytes();
    let mut len = str0.len();
    for str in &strings[1..] {
        len = cmp::min(
            len,
            str.as_bytes()
                .iter()
                .zip(str0bytes)
                .take_while(|&(a, b)| a == b)
                .count(),
        );
    }
    &strings[0][..len]
}
pub fn longest_common_prefix < ' s > ( strings : & ' s [ & str ] ) -> & ' s str { if strings . is_empty ( ) { return " " ; } let str0 = strings [ 0 ] ; let str0bytes = str0 . as_bytes ( ) ; let mut len = str0 . len ( ) ; for str in & strings [ 1 .. ] { len = cmp :: min ( len , str . as_bytes ( ) . iter ( ) . zip ( str0bytes ) . take_while ( | & ( a , b ) | a == b ) . count ( ) , ) ; } & strings [ 0 ] [ .. len ] }
Longest Common Prefix
Given a vector of string slices, calculate the string
slice that is the longest common prefix of the strings.
Longest Common Prefix Given a vector of string slices calculate the string slice that is the longest common prefix of the strings .
strings
&'s [&str]
strings
&'s [&str]