Function commands::util::longest_common_prefix [] [src]

pub fn longest_common_prefix(strings: Vec<&str>) -> &str

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 = vec!["zebrawood", "zebrafish", "zebra mussel"];
let prefix = longest_common_prefix(words);
assert_eq!(prefix, "zebra");