Function str_concat::concat_unordered [−][src]
pub fn concat_unordered<'a>(a: &'a str, b: &'a str) -> Result<&'a str, Error>
Concatenate two adjacent string slices no matter their order.
This is the same as concat
except that it also concatenates
b
to a
if b
is in front of a
(in which case concat
errors).
Examples
Reversed order:
let s = "0123456789"; assert_eq!("0123456", concat_unordered(&s[5..7], &s[..5]).unwrap());
Normal order:
let s = "0123456789"; assert_eq!("0123456", concat_unordered(&s[..5], &s[5..7]).unwrap())