Skip to main content

common_prefix

Function common_prefix 

Source
pub fn common_prefix<T: AsRef<str>>(choice: &[T]) -> &str
Expand description

Returns the longest common ASCII prefix of a collection of strings.

The result borrows from the first entry and is empty when the collection is empty or shares no prefix. Inputs are expected to be ASCII because some non-ASCII prefixes can produce an invalid byte boundary and panic.