join
fn join(Vec<string> parts, string sep) -> string Import
Source: use text::{join}; src/text.hy Returns the parts concatenated with sep between each pair.
Parameters#
| Name | Type |
|---|---|
parts | Vec<string> |
sep | string |
Returns#
string
Contracts#
Checked according to --contracts (see Contracts).
ensures parts.len() > 0 || result == ""
ensures parts.len() != 1 || result == parts[0]
Examples#
use text::{join};
use tests::assert;
let parts: Vec<string> = ["usr", "local", "bin"];
assert!(join(parts, "/") == "usr/local/bin");
See also#
byte_len: Returns the length ofsin bytes; the same ass.len().slice: Returns the part ofsfrom byte offsetstartup to (not including)end.trim_start: Returnsswithout leading ASCII whitespace (space, tab, CR, LF).trim_end: Returnsswithout trailing ASCII whitespace (space, tab, CR, LF).trim: Returnsswithout leading and trailing ASCII whitespace (space, tab, CR, LF).rfind: Returns the byte offset of the lastneedleinhay, or-1.split_at: Splitssat byte offsetatinto the part before and the part fromaton.repeat: Returnssrepeatedntimes; empty whenn <= 0.