std-method
Join string slices with a separator
Combine text fragments in order, inserting a separator only between neighboring items. The result is owned text. This method is provided for suitable slice element types, not on str itself. Expected stdout (not executed): سلام دنیا Common mistake: Calling join on a single str or expecting a trailing separator.
Formal Syntax & Structure
rust syntaxrust
[&str]::join(separator: &str) -> String (usage sketch)Working Example
Example Snippetrust
fn main() { let words = ["سلام", "دنیا"]; println!("{}", words.join(" "));}