Trait collections::str::StrVectorExperimental
[-]
[+]
[src]
pub trait StrVector {
fn concat(&self) -> String;
fn connect(&self, sep: &str) -> String;
}Methods for vectors of strings.
Required Methods
fn concat(&self) -> String
Concatenates a vector of strings.
Example
fn main() { let first = "Restaurant at the End of the".to_string(); let second = " Universe".to_string(); let string_vec = vec![first, second]; assert_eq!(string_vec.concat(), "Restaurant at the End of the Universe".to_string()); }let first = "Restaurant at the End of the".to_string(); let second = " Universe".to_string(); let string_vec = vec![first, second]; assert_eq!(string_vec.concat(), "Restaurant at the End of the Universe".to_string());
fn connect(&self, sep: &str) -> String
Concatenates a vector of strings, placing a given separator between each.
Example
fn main() { let first = "Roast".to_string(); let second = "Sirloin Steak".to_string(); let string_vec = vec![first, second]; assert_eq!(string_vec.connect(", "), "Roast, Sirloin Steak".to_string()); }let first = "Roast".to_string(); let second = "Sirloin Steak".to_string(); let string_vec = vec![first, second]; assert_eq!(string_vec.connect(", "), "Roast, Sirloin Steak".to_string());